Ejemplo n.º 1
0
            private void DismantleItem(Mobile from, Item item)
            {
                if (!from.InRange(item.GetWorldLocation(), 2))
                {
                    from.SendMessage("You need to be closer to it.");
                    return;
                }
                else if (!item.IsChildOf(from.Backpack) && !item.Movable)
                {
                    from.SendMessage("It can't be dismantled.");
                    return;
                }

                from.SendMessage("You dismantle the object.");
                Effects.PlaySound(item.GetWorldLocation(), item.Map, 0x3B3);

                if (item is Container)
                {
                    if (item is TrapableContainer)
                        (item as TrapableContainer).ExecuteTrap(from);

                    ((Container)item).Destroy();
                }
                else
                {
                    item.Delete();
                }
            }
Ejemplo n.º 2
0
		private void DestroyFurniture( Mobile from, Item item )
		{
			if ( !from.InRange( item.GetWorldLocation(), 3 ) )
			{
				from.SendLocalizedMessage( 500446 ); // That is too far away.
				return;
			}
			else if ( !item.IsChildOf( from.Backpack ) && !item.Movable )
			{
				from.SendLocalizedMessage( 500462 ); // You can't destroy that while it is here.
				return;
			}

			from.SendLocalizedMessage( 500461 ); // You destroy the item.
			Effects.PlaySound( item.GetWorldLocation(), item.Map, 0x3B3 );

			if ( item is Container )
			{
				if ( item is TrapableContainer )
					(item as TrapableContainer).ExecuteTrap( from );

				((Container)item).Destroy();
			}
			else
			{
				item.Delete();
			}
		}
Ejemplo n.º 3
0
		public static void Resurrect(Mobile m, Item item)
		{
			if (m.Alive)
			{
				return;
			}

			if (!m.InRange(item.GetWorldLocation(), ResurrectRange))
			{
				m.SendLocalizedMessage(500446); // That is too far away.
			}
			else if (m.Map != null && m.Map.CanFit(m.Location, 16, false, false))
			{
				m.CloseGump(typeof(ResurrectGump));

				/*PlayerMobile pres = m as PlayerMobile;

				if (pres.MurderBounty > 0)
					m.SendGump( new ResurrectGump( m, m, pres.MurderBounty ) );
				else*/
				m.SendGump(new ResurrectGump(m, ResurrectMessage.VirtueShrine));
			}
			else
			{
				m.SendLocalizedMessage(502391); // Thou can not be resurrected there!
			}
		}
Ejemplo n.º 4
0
		public static void Resurrect( Mobile m, Item item )
		{
			if ( m.Alive )
				return;

			if ( !m.InRange( item.GetWorldLocation(), ResurrectRange ) )
				m.SendLocalizedMessage( 500446 ); // That is too far away.
			else if( m.Map != null && m.Map.CanFit( m.Location, 16, false, false ) )
			{
				m.CloseGump( typeof( ResurrectGump ) );
				m.SendGump( new ResurrectGump( m, ResurrectMessage.VirtueShrine ) );
			}
			else
				m.SendLocalizedMessage( 502391 ); // Thou can not be resurrected there!
		}
Ejemplo n.º 5
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID == 0) // Cancel
            {
                return;
            }
            if (m_Mobile.Deleted || m_Moongate.Deleted || m_Mobile.Map == null)
            {
                return;
            }

            int[] switches = info.Switches;

            if (switches.Length == 0)
            {
                return;
            }

            int switchID  = switches[0];
            int listIndex = switchID / 100;
            int listEntry = switchID % 100;

            if (listIndex < 0 || listIndex >= m_Lists.Length)
            {
                return;
            }

            var list = m_Lists[listIndex];

            if (listEntry < 0 || listEntry >= list.Entries.Length)
            {
                return;
            }

            var entry = list.Entries[listEntry];
            var map   = entry.Map ?? list.Map;

            if (m_Mobile.Map == map && m_Mobile.InRange(entry.Location, 1))
            {
                m_Mobile.SendLocalizedMessage(1019003); // You are already there.
                return;
            }
            if (m_Mobile.IsStaff())
            {
                //Staff can always use a gate!
            }
            else if (!m_Mobile.InRange(m_Moongate.GetWorldLocation(), 1) || m_Mobile.Map != m_Moongate.Map)
            {
                m_Mobile.SendLocalizedMessage(1019002); // You are too far away to use the gate.
                return;
            }
            else if (m_Mobile.Player && SpellHelper.RestrictRedTravel && m_Mobile.Murderer && map != Map.Felucca && !Siege.SiegeShard)
            {
                m_Mobile.SendLocalizedMessage(1019004); // You are not allowed to travel there.
                return;
            }
            else if (Engines.VvV.VvVSigil.ExistsOn(m_Mobile) && map != Engines.VvV.ViceVsVirtueSystem.Facet)
            {
                m_Mobile.SendLocalizedMessage(1019004); // You are not allowed to travel there.
                return;
            }
            else if (m_Mobile.Criminal)
            {
                m_Mobile.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily.
                return;
            }
            else if (SpellHelper.CheckCombat(m_Mobile))
            {
                m_Mobile.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle??
                return;
            }
            else if (m_Mobile.Spell != null)
            {
                m_Mobile.SendLocalizedMessage(1049616); // You are too busy to do that at the moment.
                return;
            }

            BaseCreature.TeleportPets(m_Mobile, entry.Location, map);

            m_Mobile.Combatant = null;
            m_Mobile.Warmode   = false;
            m_Mobile.Hidden    = true;

            m_Mobile.MoveToWorld(entry.Location, map);

            Effects.PlaySound(entry.Location, map, 0x1FE);

            CityTradeSystem.OnQuickTravelUsed(m_Mobile);
        }
Ejemplo n.º 6
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Item.Deleted)
                {
                    return;
                }

                Item item = targeted as Item;

                if (null != item)
                {
                    bool valid = (item is IDyable ||
                                  item is BaseBook || item is BaseClothing ||
                                  item is BaseJewel || item is BaseStatuette ||
                                  item is BaseWeapon || item is Runebook ||
                                  item is Spellbook);

                    if (!valid && item is BaseArmor)
                    {
                        CraftResourceType restype = CraftResources.GetType(((BaseArmor)item).Resource);
                        if ((CraftResourceType.Leather == restype || CraftResourceType.Metal == restype) &&
                            ArmorMaterialType.Bone != ((BaseArmor)item).MaterialType)
                        {
                            valid = true;
                        }
                    }

                    if (!valid && FurnitureAttribute.Check(item))
                    {
                        if (!from.InRange(m_Item.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);   // That is too far away.
                            return;
                        }
                        else
                        {
                            BaseHouse house = BaseHouse.FindHouseAt(item);

                            if (house == null || (!house.IsLockedDown(item) && !house.IsSecure(item)))
                            {
                                from.SendLocalizedMessage(501022);   // Furniture must be locked down to paint it.
                                return;
                            }
                            else if (!house.IsCoOwner(from))
                            {
                                from.SendLocalizedMessage(501023);   // You must be the owner to use this item.
                                return;
                            }
                            else
                            {
                                valid = true;
                            }
                        }
                    }

                    // need to add any bags, chests, boxes, crates not IDyable but dyable by natural dyes


                    if (valid)
                    {
                        item.Hue = PlantPigmentHueInfo.GetInfo(m_Item.PigmentHue).Hue;
                        from.PlaySound(0x23E);

                        if (--m_Item.UsesRemaining > 0)
                        {
                            m_Item.InvalidateProperties();
                        }
                        else
                        {
                            m_Item.Delete();
                        }

                        return;
                    }
                }

                from.SendLocalizedMessage(1042083);   // You cannot dye that.
            }
Ejemplo n.º 7
0
        public virtual void Fill_OnTarget(Mobile from, object targ)
        {
            if (!IsEmpty || !Fillable || !ValidateUse(from, false))
            {
                return;
            }

            if (targ is BaseBeverage)
            {
                BaseBeverage bev = (BaseBeverage)targ;

                if (bev.IsEmpty || !bev.ValidateUse(from, true))
                {
                    return;
                }

                this.Content  = bev.Content;
                this.Poison   = bev.Poison;
                this.Poisoner = bev.Poisoner;

                if (bev.Quantity > this.MaxQuantity)
                {
                    this.Quantity = this.MaxQuantity;
                    bev.Quantity -= this.MaxQuantity;
                }
                else
                {
                    this.Quantity += bev.Quantity;
                    bev.Quantity   = 0;
                }
            }
//I ADDED for fill pitcher from statics part 1 of 3
            //NOTES:
            //StaticTarget: Hardcoded usualy item looking and Ocean Edges..
            //Items: created in game
            //LandTiles: Hard coded - Floor and Deap ocean
            else if (targ is Item /*&& ((((Item)targ).ItemID != null))*/ && AbleToGetWater(((Item)targ).ItemID))            //trying to clear up yellow. Item is never null
            {
                FillPitcherWithWater(from, this, targ);
            }

            else if (targ is StaticTarget /*&& ((((StaticTarget)targ).ItemID != null))*/ && AbleToGetWater(((StaticTarget)targ).ItemID))            //trying to clear up yellow. Item is never null
            {
                FillPitcherWithWater(from, this, targ);
            }
//I ADDED FIN for fill pitcher from statics part 1 of 3
            else if (targ is Item)
            {
                Item         item = (Item)targ;
                IWaterSource src;

                src = (item as IWaterSource);

                if (src == null && item is AddonComponent)
                {
                    src = (((AddonComponent)item).Addon as IWaterSource);
                }

                if (src == null || src.Quantity <= 0)
                {
                    return;
                }

                if (from.Map != item.Map || !from.InRange(item.GetWorldLocation(), 2) || !from.InLOS(item))
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045);                       // I can't reach that.
                    return;
                }

                this.Content  = BeverageType.Water;
                this.Poison   = null;
                this.Poisoner = null;
//I ADDED FOR SOUND
                from.PlaySound(0x4E);
//I ADDED FOR SOUND FIN

                if (src.Quantity > this.MaxQuantity)
                {
                    this.Quantity = this.MaxQuantity;
                    src.Quantity -= this.MaxQuantity;
                }
                else
                {
                    this.Quantity += src.Quantity;
                    src.Quantity   = 0;
                }

                from.SendLocalizedMessage(1010089);                   // You fill the container with water.
            }
            else if (targ is Cow)
            {
                Cow cow = (Cow)targ;

                if (cow.TryMilk(from))
                {
                    Content  = BeverageType.Milk;
                    Quantity = MaxQuantity;
                    from.SendLocalizedMessage(1080197);                       // You fill the container with milk.
                }
            }
            else if (targ is LandTarget)
            {
                int tileID = ((LandTarget)targ).TileID;

                PlayerMobile player = from as PlayerMobile;

                if (player != null)
                {
                    QuestSystem qs = player.Quest;

                    if (qs is WitchApprenticeQuest)
                    {
                        FindIngredientObjective obj = qs.FindObjective(typeof(FindIngredientObjective)) as FindIngredientObjective;

                        if (obj != null && !obj.Completed && obj.Ingredient == Ingredient.SwampWater)
                        {
                            bool contains = false;

                            for (int i = 0; !contains && i < m_SwampTiles.Length; i += 2)
                            {
                                contains = (tileID >= m_SwampTiles[i] && tileID <= m_SwampTiles[i + 1]);
                            }

                            if (contains)
                            {
                                Delete();

                                player.SendLocalizedMessage(1055035);                                   // You dip the container into the disgusting swamp water, collecting enough for the Hag's vile stew.
                                obj.Complete();
                            }
                        }
                    }
                }
            }
        }
                protected override void OnTick()
                {
                    Item item = (Item)m_Item;

                    if (!m_From.InRange(item.GetWorldLocation(), 1))
                    {
                        return;
                    }

                    if (m_Item.LockLevel == 0 || m_Item.LockLevel == -255)
                    {
                        // LockLevel of 0 means that the door can't be picklocked
                        // LockLevel of -255 means it's magic locked
                        item.SendLocalizedMessageTo(m_From, 502073);                           // This lock cannot be picked by normal means
                        return;
                    }

                    if (m_From.Skills[SkillName.Lockpicking].Value < m_Item.RequiredSkill)
                    {
                        /*
                         * // Do some training to gain skills
                         * m_From.CheckSkill( SkillName.Lockpicking, 0, m_Item.LockLevel );*/

                        // The LockLevel is higher thant the LockPicking of the player
                        m_From.SendMessage("Trying to manipulate the contraption resulted in a broken lockpick.");
                        m_Lockpick.Consume();
                        return;
                    }

                    if (m_From.CheckTargetSkill(SkillName.Lockpicking, m_Item, m_Item.LockLevel, m_Item.MaxLockLevel))
                    {
                        // Success! Pick the lock!
                        m_From.SendMessage("Woot! You succeed at picking the lock.");
                        m_From.PlaySound(0x4A);
                        m_Item.LockPick(m_From);
                    }
                    else
                    {
                        // The player failed to pick the lock
                        BrokeLockPickTest();
                        item.SendLocalizedMessageTo(m_From, 502075);                           // You are unable to pick the lock.

                        // ==== Random Item Disintergration upon Failure ====
                        if ((Core.SA) && m_Item is TreasureMapChest)
                        {
                            int i_Num = 0; Item i_Destroy = null;

                            BaseContainer m_chest = m_Item as BaseContainer;
                            Item          Dust    = new DustPile();

                            for (int i = 10; i > 0; i--)
                            {
                                i_Num = Utility.Random(m_chest.Items.Count);
                                // Make sure DustPiles aren't called for destruction
                                if ((m_chest.Items.Count > 0) && m_chest.Items[i_Num] is DustPile)
                                {
                                    for (int ci = (m_chest.Items.Count - 1); ci >= 0; ci--)
                                    {
                                        i_Num = ci;
                                        if (i_Num < 0)
                                        {
                                            i_Num = 0;
                                        }

                                        if (m_chest.Items[i_Num] is DustPile)
                                        {
                                            i_Destroy = null;
                                        }
                                        else
                                        {
                                            i_Destroy = m_chest.Items[i_Num];
                                            i_Num     = i_Num; i = 0;
                                        }
                                        // Nothing left but Dust
                                        if (ci < 0 && i > 0)
                                        {
                                            i_Destroy = null; i = 0;
                                        }
                                    }
                                }
                                // Item targetted =+= prepare for object DOOM! >;D
                                else
                                {
                                    i_Destroy = m_chest.Items[i_Num]; i = 0;
                                }
                            }
                            // Delete chosen Item and drop a Dust Pile
                            if (i_Destroy is Gold)
                            {
                                if (i_Destroy.Amount > 1000)
                                {
                                    i_Destroy.Amount -= 1000;
                                }
                                else
                                {
                                    i_Destroy.Delete();
                                }

                                Dust.Hue = 1177; m_chest.DropItem(Dust);
                            }
                            else if (i_Destroy != null)
                            {
                                i_Destroy.Delete(); m_chest.DropItem(Dust);
                            }
                            Effects.PlaySound(m_chest.Location, m_chest.Map, 0x1DE);
                            m_chest.PublicOverheadMessage(MessageType.Regular, 2004, false, "The sound of gas escaping is heard from the chest.");
                        }
                    }
                }
Ejemplo n.º 9
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Tub == null || m_Tub.Deleted)
                {
                    return;
                }

                if (targeted is Item)
                {
                    Item item = (Item)targeted;

                    if (item is IDyable && m_Tub.AllowDyables)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446); // That is too far away.
                        }
                        else if (item.Parent is Mobile)
                        {
                            from.SendLocalizedMessage(500861); // Can't Dye clothing that is being worn.
                        }
                        else if (!item.Movable)
                        {
                            from.SendMessage("You cannot dye items that are locked down.");
                        }
                        else if (((IDyable)item).Dye(from, m_Tub))
                        {
                            m_Tub.UseCharge(from);

                            from.PlaySound(0x23E);
                        }
                    }
                    else if ((FurnitureAttribute.Check(item) || (item is PotionKeg)) && m_Tub.AllowFurniture)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446); // That is too far away.
                        }
                        else
                        {
                            bool okay = (item.IsChildOf(from.Backpack));

                            if (!okay)
                            {
                                if (item.Parent == null)
                                {
                                    BaseHouse house = BaseHouse.FindHouseAt(item);

                                    if (house == null || (!house.IsLockedDown(item) && !house.IsSecure(item)))
                                    {
                                        from.SendLocalizedMessage(501022); // Furniture must be locked down to paint it.
                                    }
                                    else if (!house.IsCoOwner(from))
                                    {
                                        from.SendLocalizedMessage(501023); // You must be the owner to use this item.
                                    }
                                    else
                                    {
                                        okay = true;
                                    }
                                }
                                else
                                {
                                    from.SendLocalizedMessage(1048135); // The furniture must be in your backpack to be painted.
                                }
                            }

                            if (okay)
                            {
                                m_Tub.UseCharge(from);

                                item.Hue = m_Tub.DyedHue;
                                from.PlaySound(0x23E);
                            }
                        }
                    }
                    else if ((item is Runebook || item is RecallRune) && m_Tub.AllowRunebooks)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446); // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1049776); // You cannot dye runes or runebooks that are locked down.
                        }
                        else
                        {
                            m_Tub.UseCharge(from);

                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    else if (item is MonsterStatuette && m_Tub.AllowStatuettes)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446); // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1049779); // You cannot dye statuettes that are locked down.
                        }
                        else
                        {
                            m_Tub.UseCharge(from);

                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    else if ((item is BaseArmor && (((BaseArmor)item).MaterialType == ArmorMaterialType.Leather || ((BaseArmor)item).MaterialType == ArmorMaterialType.Studded) || item is ElvenBoots || item is WoodlandBelt) && m_Tub.AllowLeather)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446); // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1042419); // You may not dye leather items which are locked down.
                        }
                        else if (item.Parent is Mobile)
                        {
                            from.SendLocalizedMessage(500861); // Can't Dye clothing that is being worn.
                        }
                        else
                        {
                            m_Tub.UseCharge(from);
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(m_Tub.FailMessage);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(m_Tub.FailMessage);
                }
            }
Ejemplo n.º 10
0
                protected override void OnTick()
                {
                    Item item = (Item)m_Item;

                    if (m_From.Skills[SkillName.Lockpicking].Base < 1)
                    {
                        int cycle = 10;

                        while (cycle > 0)
                        {
                            cycle--;
                            m_From.CheckTargetSkill(SkillName.Lockpicking, m_Item, 0, 10);
                        }
                    }

                    if (!m_From.InRange(item.GetWorldLocation(), 1))
                    {
                        return;
                    }

                    if (m_Item.LockLevel == 0 || m_Item.LockLevel == -255)
                    {
                        // LockLevel of 0 means that the door can't be picklocked
                        // LockLevel of -255 means it's magic locked
                        if (m_Lockpick.ItemID == 0x3A75)
                        {
                            m_From.PrivateOverheadMessage(0, 1150, false, "This lock cannot be hacked by normal means.", m_From.NetState);
                        }
                        else
                        {
                            m_From.PrivateOverheadMessage(0, 1150, false, "This lock cannot be picked by normal means.", m_From.NetState);
                        }

                        return;
                    }

                    if ((m_From.Skills[SkillName.Lockpicking].Value + 2) < m_Item.RequiredSkill)
                    {
                        /*
                         * // Do some training to gain skills
                         * m_From.CheckSkill( SkillName.Lockpicking, 0, m_Item.LockLevel );*/

                        // The LockLevel is higher thant the LockPicking of the player
                        if (m_Lockpick.ItemID == 0x3A75)
                        {
                            m_From.PrivateOverheadMessage(0, 1150, false, "You don't see how that lock can be hacked.", m_From.NetState);
                        }
                        else
                        {
                            m_From.PrivateOverheadMessage(0, 1150, false, "You don't see how that lock can be manipulated.", m_From.NetState);
                        }
                        return;
                    }

                    if (m_From.CheckTargetSkill(SkillName.Lockpicking, m_Item, m_Item.LockLevel, m_Item.MaxLockLevel))
                    {
                        // Success! Pick the lock!
                        if (m_Lockpick.ItemID == 0x3A75)
                        {
                            m_From.PlaySound(0x54B); m_From.PrivateOverheadMessage(0, 1150, false, "Your skill at hacking worked.", m_From.NetState);
                        }
                        else
                        {
                            m_From.PlaySound(0x4A); m_From.PrivateOverheadMessage(0, 1150, false, "The lock quickly yields to your skill.", m_From.NetState);
                        }

                        m_Item.LockPick(m_From);
                    }
                    else
                    {
                        // The player failed to pick the lock
                        BrokeLockPickTest();

                        if (m_Lockpick.ItemID == 0x3A75)
                        {
                            m_From.PrivateOverheadMessage(0, 1150, false, "You are unable to hack the lock.", m_From.NetState);
                        }
                        else
                        {
                            m_From.PrivateOverheadMessage(0, 1150, false, "You are unable to pick the lock.", m_From.NetState);
                        }

                        // ==== Random Item Disintergration upon Failure ====
                        if (m_Item is TreasureMapChest)
                        {
                            int i_Num = 0; Item i_Destroy = null;

                            BaseContainer m_chest = m_Item as BaseContainer;
                            Item          Dust    = new DustPile();

                            for (int i = 10; i > 0; i--)
                            {
                                i_Num = Utility.Random(m_chest.Items.Count);
                                // Make sure DustPiles aren't called for destruction
                                if ((m_chest.Items.Count > 0) && m_chest.Items[i_Num] is DustPile)
                                {
                                    for (int ci = (m_chest.Items.Count - 1); ci >= 0; ci--)
                                    {
                                        i_Num = ci;
                                        if (i_Num < 0)
                                        {
                                            i_Num = 0;
                                        }

                                        if (m_chest.Items[i_Num] is DustPile)
                                        {
                                            i_Destroy = null;
                                        }
                                        else
                                        {
                                            i_Destroy = m_chest.Items[i_Num];
                                            i         = 0;
                                        }
                                        // Nothing left but Dust
                                        if (ci < 0 && i > 0)
                                        {
                                            i_Destroy = null; i = 0;
                                        }
                                    }
                                }
                                // Item targeted =+= prepare for object DOOM! >;D
                                else
                                {
                                    i_Destroy = m_chest.Items[i_Num]; i = 0;
                                }
                            }
                            // Delete chosen Item and drop a Dust Pile
                            if (i_Destroy is Gold)
                            {
                                if (i_Destroy.Amount > 1000)
                                {
                                    i_Destroy.Amount -= 1000;
                                }
                                else
                                {
                                    i_Destroy.Delete();
                                }

                                Dust.Hue = 1177; m_chest.DropItem(Dust);
                            }
                            else if (i_Destroy != null)
                            {
                                i_Destroy.Delete(); m_chest.DropItem(Dust);
                            }
                            Effects.PlaySound(m_chest.Location, m_chest.Map, 0x1DE);
                            m_chest.PublicOverheadMessage(MessageType.Regular, 2004, false, "The sound of gas escaping is heard from the chest.");
                        }
                    }
                }
Ejemplo n.º 11
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID == 0)               // Cancel
            {
                return;
            }
            else if (m_Mobile.Deleted || m_Moongate.Deleted || m_Mobile.Map == null)
            {
                return;
            }

            if (info.ButtonID == 2)               //City
            {
                ArrayList a = new ArrayList();

                foreach (Item i in World.Items.Values)
                {
                    if (i is CityManagementStone)
                    {
                        CityManagementStone s = (CityManagementStone)i;

                        if (s.HasMoongate == true && s.IsRegistered == true)
                        {
                            a.Add(i);
                        }
                    }
                }

                if (a.Count == 0)
                {
                    m_Mobile.SendGump(new NoCitiesGump());
                }
                else
                {
                    m_Mobile.SendGump(new PCMoongateGump(m_Moongate, 0, null, null));
                }
            }

            int[] switches = info.Switches;

            if (switches.Length == 0)
            {
                return;
            }

            int switchID  = switches[0];
            int listIndex = switchID / 100;
            int listEntry = switchID % 100;

            if (listIndex < 0 || listIndex >= m_Lists.Length)
            {
                return;
            }

            PMList list = m_Lists[listIndex];

            if (listEntry < 0 || listEntry >= list.Entries.Length)
            {
                return;
            }

            PMEntry entry = list.Entries[listEntry];

            if (!m_Mobile.InRange(m_Moongate.GetWorldLocation(), 1) || m_Mobile.Map != m_Moongate.Map)
            {
                m_Mobile.SendLocalizedMessage(1019002);                   // You are too far away to use the gate.
            }
            else if (m_Mobile.Player && m_Mobile.Kills >= 5 && list.Map != Map.Felucca)
            {
                m_Mobile.SendLocalizedMessage(1019004);                   // You are not allowed to travel there.
            }
            else if (Factions.Sigil.ExistsOn(m_Mobile) && list.Map != Factions.Faction.Facet)
            {
                m_Mobile.SendLocalizedMessage(1019004);                   // You are not allowed to travel there.
            }
            else if (m_Mobile.Criminal)
            {
                m_Mobile.SendLocalizedMessage(1005561, "", 0x22);                   // Thou'rt a criminal and cannot escape so easily.
            }
            else if (SpellHelper.CheckCombat(m_Mobile))
            {
                m_Mobile.SendLocalizedMessage(1005564, "", 0x22);                   // Wouldst thou flee during the heat of battle??
            }
            else if (m_Mobile.Spell != null)
            {
                m_Mobile.SendLocalizedMessage(1049616);                   // You are too busy to do that at the moment.
            }
            else if (m_Mobile.Map == list.Map && m_Mobile.InRange(entry.Location, 1))
            {
                m_Mobile.SendLocalizedMessage(1019003);                   // You are already there.
            }
            else
            {
                CityManagementStone outgoingCity = null;
                Region currentRegion             = Region.Find(m_Mobile.Location, m_Mobile.Map);

                if (currentRegion != null)
                {
                    if (currentRegion is PlayerCityRegion)
                    {
                        PlayerCityRegion pcr = (PlayerCityRegion)currentRegion;

                        outgoingCity = pcr.Stone;
                    }
                }

                if (outgoingCity != null && outgoingCity.TravelTax >= 1)
                {
                    m_Mobile.SendGump(new PCMoongateToll2Gump(m_Moongate, outgoingCity, entry.Location, list.Map));
                }
                else
                {
                    BaseCreature.TeleportPets(m_Mobile, entry.Location, list.Map);

                    m_Mobile.Combatant = null;
                    m_Mobile.Warmode   = false;
                    m_Mobile.Hidden    = true;

                    m_Mobile.MoveToWorld(entry.Location, list.Map);

                    Effects.PlaySound(entry.Location, list.Map, 0x1FE);
                }
            }
        }
Ejemplo n.º 12
0
        public static void OnLoomLoop(ILoom loom, Mobile from, int hue, Item thread)
        {
            if (loom.Phase > 4)
            {
                loom.Phase = 0;
                Item item = new BoltOfCloth();
                item.Hue = hue;
                from.AddToBackpack(item);
                from.SendLocalizedMessage(500368); // You create some cloth and put it in your backpack.
            }

            LoomQuotaAttachment att = (LoomQuotaAttachment)XmlAttach.FindAttachment(from, typeof(LoomQuotaAttachment));

            if (att == null)
            {
                att = new LoomQuotaAttachment();
                XmlAttach.AttachTo(from, att);
            }
            att.RemoveLooms((Item)loom);

            if (from.NetState == null) // player logged off
            {
                return;
            }
            if (thread.Deleted || thread.Amount < 1 || !(thread is BaseClothMaterial))
            {
                from.SendMessage("You finished processing all the threads/yarns.");
            }
            else if (!thread.IsChildOf(from.Backpack))
            {
                from.SendMessage("You can not continue without the threads/yarns in your backpack.");
            }
            else if (loom is Item)
            {
                Item loom1 = (Item)loom;

                if (loom1.Deleted)
                {
                    from.SendMessage("Where did the loom go?");
                }
                else if (!from.InRange(loom1.GetWorldLocation(), 3))
                {
                    from.SendMessage("You are too far away from the loom to continue your work.");
                }
                else if (loom.Looming)
                {
                    from.SendMessage("That loom is being used.");
                }
                else
                {
                    if (att.getNumLooms() < LoomQuotaAttachment.m_LoomQuotaCap)
                    {
                        att.AddLooms(loom1);
                        if (Utility.Random(20 * att.getNumLooms()) < 1)
                        {
                            from.PublicOverheadMessage(Server.Network.MessageType.Emote, 51, false, "*looming*");
                        }
                        thread.Consume();
                        loom.BeginLoom(new LoomCallback(BaseClothMaterial.OnLoomLoop), from, thread.Hue, thread);
                        return;
                    }
                    else
                    {
                        from.SendMessage("You are too occupied with the " + LoomQuotaAttachment.m_LoomQuotaCap.ToString() + " looms you are running.");
                    }
                }
            }
        }
Ejemplo n.º 13
0
        public void DoEffect(Mobile atk, Mobile def)
        {
            double chances = GetChances(atk, def);

            NextUse = DateTime.Now.AddSeconds(CooldownTime);
            Item weapon = Weapon(def);

            if (def.Spell != null)
            {
                if (def.Spell.IsCasting && (GetBonus(def.Skills[SkillName.ArtMagique].Value, 0.2, 5) + GetBonus(def.Skills[SkillName.Meditation].Value, 0.2, 5)) <= Utility.RandomDouble())
                {
                    //def.DisruptiveAction();
                }
            }

            if (chances >= Utility.RandomDouble())
            {
                new WaitTimer(def, TimeSpan.FromSeconds(2 * WaitTime)).Start();
                if (weapon != null)
                {
                    if (atk is ScriptMobile)
                    {
                        ScriptMobile mob = (ScriptMobile)atk;
                        if (mob.PVPInfo != null)
                        {
                            if (!mob.PVPInfo.CurrentEvent.mode.AllowLoot())
                            {
                                def.AddToBackpack(weapon);
                                DoAnimation(atk, def, Sounds.SuccessDrop);

                                BaseWeapon.BlockEquip(def, TimeSpan.FromSeconds(chances * BlockEquipDuration));
                                atk.Stam -= (int)((1 - chances) * 150);
                                def.Damage(15, atk);
                                atk.RevealingAction();
                                def.RevealingAction();
                                return;
                            }
                        }
                    }

                    double malus = (weapon.Layer == Layer.OneHanded) ? 0.5 : 0.3;
                    if (malus * chances >= Utility.RandomDouble() && !atk.Mounted) //Steal the weapon
                    {
                        atk.AddToBackpack(weapon);
                        DoAnimation(atk, def, Sounds.SuccessSteal);
                    }
                    else                                                           //Drop the weapon
                    {
                        weapon.MoveToWorld(weapon.GetWorldLocation(), weapon.Map);
                        DoAnimation(atk, def, Sounds.SuccessDrop);
                    }
                    BaseWeapon.BlockEquip(def, TimeSpan.FromSeconds(chances * BlockEquipDuration));
                }
                else                                                               //Fail
                {
                    DoAnimation(atk, def, Sounds.Whip);
                }
                atk.Stam -= (int)((1 - chances) * 150);
                def.Damage(15, atk);
            }
            else
            {
                new WaitTimer(def, TimeSpan.FromSeconds(WaitTime)).Start();
                DoAnimation(atk, def, Sounds.Miss);
            }

            atk.RevealingAction();
            def.RevealingAction();
            //atk.DisruptiveAction();
        }
Ejemplo n.º 14
0
        public virtual void Fill_OnTarget(Mobile from, object targ)
        {
            if (!IsEmpty || !Fillable || !ValidateUse(from, false))
            {
                return;
            }

            if (targ is Aquarium)
            {
                Aquarium aquarium = targ as Aquarium;

                if (aquarium.WaterLevel < Aquarium.MaxWaterLevel)
                {
                    int waterNeeded = Aquarium.MaxWaterLevel - aquarium.WaterLevel;
                    int waterUsed   = waterNeeded;

                    if (Quantity < waterUsed)
                    {
                        waterUsed = Quantity;
                    }

                    aquarium.WaterLevel += waterUsed;
                    Quantity            -= waterUsed;

                    from.PlaySound(0x4E);

                    from.CloseGump(typeof(AquariumGump));
                    from.SendMessage("You add water to the aquarium.");
                }
            }

            if (targ is BaseBeverage)
            {
                BaseBeverage bev = (BaseBeverage)targ;

                if (bev.IsEmpty || !bev.ValidateUse(from, true))
                {
                    return;
                }

                this.Content  = bev.Content;
                this.Poison   = bev.Poison;
                this.Poisoner = bev.Poisoner;

                if (bev.Quantity > this.MaxQuantity)
                {
                    this.Quantity = this.MaxQuantity;
                    bev.Quantity -= this.MaxQuantity;
                }
                else
                {
                    this.Quantity += bev.Quantity;
                    bev.Quantity   = 0;
                }
            }

            if (targ is Aquarium)
            {
                Aquarium aquarium = targ as Aquarium;

                if (aquarium.WaterLevel < Aquarium.MaxWaterLevel)
                {
                    int waterNeeded = Aquarium.MaxWaterLevel - aquarium.WaterLevel;
                    int waterAdded  = waterNeeded;

                    if (Quantity < waterAdded)
                    {
                        waterAdded = Quantity;
                    }

                    Quantity            -= waterAdded;
                    aquarium.WaterLevel += waterAdded;

                    from.PlaySound(0x4E);

                    from.CloseGump(typeof(AquariumGump));
                    from.SendMessage("You add water to the aquarium.");
                }

                else
                {
                    from.SendMessage("That aquarium is already full of water.");
                }
            }

            else if (targ is BaseWaterContainer)
            {
                BaseWaterContainer bwc = targ as BaseWaterContainer;

                if (Quantity == 0 || (Content == BeverageType.Water && !IsFull))
                {
                    int iNeed = Math.Min((MaxQuantity - Quantity), bwc.Quantity);

                    if (iNeed > 0 && !bwc.IsEmpty && !IsFull)
                    {
                        bwc.Quantity -= iNeed;
                        Quantity     += iNeed;
                        Content       = BeverageType.Water;

                        from.PlaySound(0x4E);
                    }
                }
            }
            else if (targ is Item)
            {
                Item         item = (Item)targ;
                IWaterSource src;

                src = (item as IWaterSource);

                if (src == null && item is AddonComponent)
                {
                    src = (((AddonComponent)item).Addon as IWaterSource);
                }

                if (src == null || src.Quantity <= 0)
                {
                    return;
                }

                if (from.Map != item.Map || !from.InRange(item.GetWorldLocation(), 2) || !from.InLOS(item))
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
                    return;
                }

                this.Content  = BeverageType.Water;
                this.Poison   = null;
                this.Poisoner = null;

                if (src.Quantity > this.MaxQuantity)
                {
                    this.Quantity = this.MaxQuantity;
                    src.Quantity -= this.MaxQuantity;
                }
                else
                {
                    this.Quantity += src.Quantity;
                    src.Quantity   = 0;
                }

                from.SendLocalizedMessage(1010089); // You fill the container with water.
            }

            else if (targ is LandTarget)
            {
                int tileID = ((LandTarget)targ).TileID;

                PlayerMobile player = from as PlayerMobile;

                if (player != null)
                {
                }
            }
        }
Ejemplo n.º 15
0
        public static void OnSpunLoop(ISpinningWheel wheel, Mobile from, int hue, Item cotton)
        {
            Item item = new SpoolOfThread(3);

            item.Hue = hue;
            from.AddToBackpack(item);

            SpinningWheelQuotaAttachment att = (SpinningWheelQuotaAttachment)XmlAttach.FindAttachment(from, typeof(SpinningWheelQuotaAttachment));

            if (att == null)
            {
                att = new SpinningWheelQuotaAttachment();
                XmlAttach.AttachTo(from, att);
            }
            att.RemoveWheels((Item)wheel);

            if (from.NetState == null) // player logged off
            {
                return;
            }
            if (cotton.Deleted || cotton.Amount < 1 || !(cotton is Flax))
            {
                from.SendMessage("You finished processing all the flax.");
            }
            else if (!cotton.IsChildOf(from.Backpack))
            {
                from.SendMessage("You can not continue without the flax in your backpack.");
            }
            else if (wheel is Item)
            {
                Item wheel1 = (Item)wheel;

                if (wheel1.Deleted)
                {
                    from.SendMessage("Where did the spinning wheel go?");
                }
                else if (!from.InRange(wheel1.GetWorldLocation(), 3))
                {
                    from.SendMessage("You are too far away from the spinning wheel to continue your work.");
                }
                else if (wheel.Spinning)
                {
                    from.SendLocalizedMessage(502656); // That spinning wheel is being used.
                }
                else
                {
                    if (att.getNumWheels() < SpinningWheelQuotaAttachment.m_WheelQuotaCap)
                    {
                        att.AddWheels(wheel1);
                        if (Utility.Random(6 * att.getNumWheels()) < 1)
                        {
                            from.PublicOverheadMessage(Server.Network.MessageType.Emote, 51, false, "*spinning*");
                        }
                        cotton.Consume();
                        wheel.BeginSpin(new SpinCallback(Flax.OnSpunLoop), from, cotton.Hue, cotton);
                        return;
                    }
                    else
                    {
                        from.SendMessage("You are too occupied with the " + SpinningWheelQuotaAttachment.m_WheelQuotaCap.ToString() + " spinning wheels you are running.");
                    }
                }
            }
            from.SendLocalizedMessage(1010577); // You put the spools of thread in your backpack.
        }
Ejemplo n.º 16
0
        public static void IDItem(Mobile from, Item examine, object o, bool automatic)
        {
            if (!examine.Movable)
            {
                from.SendMessage("That cannot move so you cannot identify it.");
            }
            else if (!from.InRange(examine.GetWorldLocation(), 3))
            {
                from.SendMessage("You will need to get closer to identify that.");
            }
            else if (!(examine.IsChildOf(from.Backpack)) && Server.Misc.MyServerSettings.IdentifyItemsOnlyInPack())
            {
                from.SendMessage("This must be in your backpack to identify.");
            }
            else if ((examine is UnknownLiquid) || (examine is UnknownReagent) || (examine is UnknownKeg))
            {
                from.SendMessage("You need to use Taste Identification to identify that.");
            }
            /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            else if (examine is UnknownScroll)
            {
                bool CanID = automatic;
                int  bonus = 0;

                if (from.CheckTargetSkill(SkillName.ItemID, o, -5, 120))
                {
                    CanID = true;
                }

                if (from.Skills[SkillName.Inscribe].Base >= 5)
                {
                    if (from.CheckSkill(SkillName.Inscribe, 0, 120))
                    {
                        CanID = true;
                    }
                    bonus = 1;
                    if (from.Skills[SkillName.Inscribe].Base >= 50)
                    {
                        bonus = 2;
                    }
                }

                if (examine is LibraryScroll1 || examine is LibraryScroll2 || examine is LibraryScroll3 || examine is LibraryScroll4 || examine is LibraryScroll5 || examine is LibraryScroll6)
                {
                    bonus = 0;
                }

                if (CanID)
                {
                    from.PlaySound(0x249);

                    if (Utility.RandomMinMax(1, 100) > 10)
                    {
                        UnknownScroll rolls       = (UnknownScroll)examine;
                        int           scrollLevel = rolls.ScrollLevel + bonus;
                        if (scrollLevel > 6)
                        {
                            scrollLevel = 6;
                        }

                        int paperType = 1;

                        if (rolls.ScrollType == 1)                           // MAGERY
                        {
                            if (scrollLevel == 2)
                            {
                                paperType = Utility.RandomMinMax(13, 24);
                            }
                            else if (scrollLevel == 3)
                            {
                                paperType = Utility.RandomMinMax(25, 36);
                            }
                            else if (scrollLevel == 4)
                            {
                                paperType = Utility.RandomMinMax(37, 48);
                            }
                            else if (scrollLevel == 5)
                            {
                                paperType = Utility.RandomMinMax(49, 60);
                            }
                            else if (scrollLevel == 6)
                            {
                                paperType = Utility.RandomMinMax(57, 64);
                            }
                            else
                            {
                                paperType = Utility.RandomMinMax(1, 12);
                            }
                        }
                        else if (rolls.ScrollType == 3)                           // BARD
                        {
                            paperType = Utility.RandomMinMax(82, 97);
                        }
                        else
                        {
                            if (scrollLevel == 2)
                            {
                                paperType = Utility.RandomMinMax(68, 70);
                            }
                            else if (scrollLevel == 3)
                            {
                                paperType = Utility.RandomMinMax(71, 73);
                            }
                            else if (scrollLevel == 4)
                            {
                                paperType = Utility.RandomMinMax(74, 76);
                            }
                            else if (scrollLevel == 5)
                            {
                                paperType = Utility.RandomMinMax(77, 79);
                            }
                            else if (scrollLevel == 6)
                            {
                                paperType = Utility.RandomMinMax(80, 81);
                            }
                            else
                            {
                                paperType = Utility.RandomMinMax(65, 67);
                            }
                        }

                        string paperName = "";

                        if (paperType == 1)
                        {
                            from.AddToBackpack(new ReactiveArmorScroll()); paperName = "reactive armor";
                        }
                        else if (paperType == 2)
                        {
                            from.AddToBackpack(new ClumsyScroll()); paperName = "clumsy";
                        }
                        else if (paperType == 3)
                        {
                            from.AddToBackpack(new CreateFoodScroll()); paperName = "create food";
                        }
                        else if (paperType == 4)
                        {
                            from.AddToBackpack(new FeeblemindScroll()); paperName = "feeblemind";
                        }
                        else if (paperType == 5)
                        {
                            from.AddToBackpack(new HealScroll()); paperName = "heal";
                        }
                        else if (paperType == 6)
                        {
                            from.AddToBackpack(new MagicArrowScroll()); paperName = "magic arrow";
                        }
                        else if (paperType == 7)
                        {
                            from.AddToBackpack(new NightSightScroll()); paperName = "night sight";
                        }
                        else if (paperType == 8)
                        {
                            from.AddToBackpack(new WeakenScroll()); paperName = "weaken";
                        }
                        else if (paperType == 9)
                        {
                            from.AddToBackpack(new AgilityScroll()); paperName = "agility";
                        }
                        else if (paperType == 10)
                        {
                            from.AddToBackpack(new CunningScroll()); paperName = "cunning";
                        }
                        else if (paperType == 11)
                        {
                            from.AddToBackpack(new CureScroll()); paperName = "cure";
                        }
                        else if (paperType == 12)
                        {
                            from.AddToBackpack(new HarmScroll()); paperName = "harm";
                        }
                        else if (paperType == 13)
                        {
                            from.AddToBackpack(new MagicTrapScroll()); paperName = "magic trap";
                        }
                        else if (paperType == 14)
                        {
                            from.AddToBackpack(new MagicUnTrapScroll()); paperName = "magic untrap";
                        }
                        else if (paperType == 15)
                        {
                            from.AddToBackpack(new ProtectionScroll()); paperName = "protection";
                        }
                        else if (paperType == 16)
                        {
                            from.AddToBackpack(new StrengthScroll()); paperName = "strength";
                        }
                        else if (paperType == 17)
                        {
                            from.AddToBackpack(new BlessScroll()); paperName = "bless";
                        }
                        else if (paperType == 18)
                        {
                            from.AddToBackpack(new FireballScroll()); paperName = "fireball";
                        }
                        else if (paperType == 19)
                        {
                            from.AddToBackpack(new MagicLockScroll()); paperName = "magic lock";
                        }
                        else if (paperType == 20)
                        {
                            from.AddToBackpack(new PoisonScroll()); paperName = "poison";
                        }
                        else if (paperType == 21)
                        {
                            from.AddToBackpack(new TelekinisisScroll()); paperName = "telekinesis";
                        }
                        else if (paperType == 22)
                        {
                            from.AddToBackpack(new TeleportScroll()); paperName = "teleport";
                        }
                        else if (paperType == 23)
                        {
                            from.AddToBackpack(new UnlockScroll()); paperName = "unlock";
                        }
                        else if (paperType == 24)
                        {
                            from.AddToBackpack(new WallOfStoneScroll()); paperName = "wall of stone";
                        }
                        else if (paperType == 25)
                        {
                            from.AddToBackpack(new ArchCureScroll()); paperName = "arch cure";
                        }
                        else if (paperType == 26)
                        {
                            from.AddToBackpack(new ArchProtectionScroll()); paperName = "arch protection";
                        }
                        else if (paperType == 27)
                        {
                            from.AddToBackpack(new CurseScroll()); paperName = "curse";
                        }
                        else if (paperType == 28)
                        {
                            from.AddToBackpack(new FireFieldScroll()); paperName = "fire field";
                        }
                        else if (paperType == 29)
                        {
                            from.AddToBackpack(new GreaterHealScroll()); paperName = "greater heal";
                        }
                        else if (paperType == 30)
                        {
                            from.AddToBackpack(new LightningScroll()); paperName = "lightning";
                        }
                        else if (paperType == 31)
                        {
                            from.AddToBackpack(new ManaDrainScroll()); paperName = "mana drain";
                        }
                        else if (paperType == 32)
                        {
                            from.AddToBackpack(new RecallScroll()); paperName = "recall";
                        }
                        else if (paperType == 33)
                        {
                            from.AddToBackpack(new BladeSpiritsScroll()); paperName = "blade spirits";
                        }
                        else if (paperType == 34)
                        {
                            from.AddToBackpack(new DispelFieldScroll()); paperName = "dispel field";
                        }
                        else if (paperType == 35)
                        {
                            from.AddToBackpack(new IncognitoScroll()); paperName = "incognito";
                        }
                        else if (paperType == 36)
                        {
                            from.AddToBackpack(new MagicReflectScroll()); paperName = "magic reflect";
                        }
                        else if (paperType == 37)
                        {
                            from.AddToBackpack(new MindBlastScroll()); paperName = "mind blast";
                        }
                        else if (paperType == 38)
                        {
                            from.AddToBackpack(new ParalyzeScroll()); paperName = "paralyze";
                        }
                        else if (paperType == 39)
                        {
                            from.AddToBackpack(new PoisonFieldScroll()); paperName = "poison field";
                        }
                        else if (paperType == 40)
                        {
                            from.AddToBackpack(new SummonCreatureScroll()); paperName = "summon creature";
                        }
                        else if (paperType == 41)
                        {
                            from.AddToBackpack(new DispelScroll()); paperName = "dispel";
                        }
                        else if (paperType == 42)
                        {
                            from.AddToBackpack(new EnergyBoltScroll()); paperName = "energy bolt";
                        }
                        else if (paperType == 43)
                        {
                            from.AddToBackpack(new ExplosionScroll()); paperName = "explosion";
                        }
                        else if (paperType == 44)
                        {
                            from.AddToBackpack(new InvisibilityScroll()); paperName = "invisibility";
                        }
                        else if (paperType == 45)
                        {
                            from.AddToBackpack(new MarkScroll()); paperName = "mark";
                        }
                        else if (paperType == 46)
                        {
                            from.AddToBackpack(new MassCurseScroll()); paperName = "mass curse";
                        }
                        else if (paperType == 47)
                        {
                            from.AddToBackpack(new ParalyzeFieldScroll()); paperName = "paralyze field";
                        }
                        else if (paperType == 48)
                        {
                            from.AddToBackpack(new RevealScroll()); paperName = "reveal";
                        }
                        else if (paperType == 49)
                        {
                            from.AddToBackpack(new ChainLightningScroll()); paperName = "chain lightning";
                        }
                        else if (paperType == 50)
                        {
                            from.AddToBackpack(new EnergyFieldScroll()); paperName = "energy field";
                        }
                        else if (paperType == 51)
                        {
                            from.AddToBackpack(new FlamestrikeScroll()); paperName = "flamestrike";
                        }
                        else if (paperType == 52)
                        {
                            from.AddToBackpack(new GateTravelScroll()); paperName = "gate travel";
                        }
                        else if (paperType == 53)
                        {
                            from.AddToBackpack(new ManaVampireScroll()); paperName = "mana vampire";
                        }
                        else if (paperType == 54)
                        {
                            from.AddToBackpack(new MassDispelScroll()); paperName = "mass dispel";
                        }
                        else if (paperType == 55)
                        {
                            from.AddToBackpack(new MeteorSwarmScroll()); paperName = "meteor swarm";
                        }
                        else if (paperType == 56)
                        {
                            from.AddToBackpack(new PolymorphScroll()); paperName = "polymorph";
                        }
                        else if (paperType == 57)
                        {
                            from.AddToBackpack(new EarthquakeScroll()); paperName = "earthquake";
                        }
                        else if (paperType == 58)
                        {
                            from.AddToBackpack(new EnergyVortexScroll()); paperName = "energy vortex";
                        }
                        else if (paperType == 59)
                        {
                            from.AddToBackpack(new ResurrectionScroll()); paperName = "resurrection";
                        }
                        else if (paperType == 60)
                        {
                            from.AddToBackpack(new SummonAirElementalScroll()); paperName = "summon air elemental";
                        }
                        else if (paperType == 61)
                        {
                            from.AddToBackpack(new SummonDaemonScroll()); paperName = "summon daemon";
                        }
                        else if (paperType == 62)
                        {
                            from.AddToBackpack(new SummonEarthElementalScroll()); paperName = "summon earth elemental";
                        }
                        else if (paperType == 63)
                        {
                            from.AddToBackpack(new SummonFireElementalScroll()); paperName = "summon fire elemental";
                        }
                        else if (paperType == 64)
                        {
                            from.AddToBackpack(new SummonWaterElementalScroll()); paperName = "summon water elemental";
                        }
                        else if (paperType == 65)
                        {
                            from.AddToBackpack(new CurseWeaponScroll()); paperName = "curse weapon";
                        }
                        else if (paperType == 66)
                        {
                            from.AddToBackpack(new BloodOathScroll()); paperName = "blood oath";
                        }
                        else if (paperType == 67)
                        {
                            from.AddToBackpack(new CorpseSkinScroll()); paperName = "corpse skin";
                        }
                        else if (paperType == 68)
                        {
                            from.AddToBackpack(new EvilOmenScroll()); paperName = "evil omen";
                        }
                        else if (paperType == 69)
                        {
                            from.AddToBackpack(new PainSpikeScroll()); paperName = "pain spike";
                        }
                        else if (paperType == 70)
                        {
                            from.AddToBackpack(new WraithFormScroll()); paperName = "wraith form";
                        }
                        else if (paperType == 71)
                        {
                            from.AddToBackpack(new MindRotScroll()); paperName = "mind rot";
                        }
                        else if (paperType == 72)
                        {
                            from.AddToBackpack(new SummonFamiliarScroll()); paperName = "summon familiar";
                        }
                        else if (paperType == 73)
                        {
                            from.AddToBackpack(new AnimateDeadScroll()); paperName = "animate dead";
                        }
                        else if (paperType == 74)
                        {
                            from.AddToBackpack(new HorrificBeastScroll()); paperName = "horrific beast";
                        }
                        else if (paperType == 75)
                        {
                            from.AddToBackpack(new PoisonStrikeScroll()); paperName = "poison strike";
                        }
                        else if (paperType == 76)
                        {
                            from.AddToBackpack(new WitherScroll()); paperName = "wither";
                        }
                        else if (paperType == 77)
                        {
                            from.AddToBackpack(new StrangleScroll()); paperName = "strangle";
                        }
                        else if (paperType == 78)
                        {
                            from.AddToBackpack(new LichFormScroll()); paperName = "lich form";
                        }
                        else if (paperType == 79)
                        {
                            from.AddToBackpack(new ExorcismScroll()); paperName = "exorcism";
                        }
                        else if (paperType == 80)
                        {
                            from.AddToBackpack(new VengefulSpiritScroll()); paperName = "vengeful spirit";
                        }
                        else if (paperType == 81)
                        {
                            from.AddToBackpack(new VampiricEmbraceScroll()); paperName = "vampiric embrace";
                        }
                        else if (paperType == 82)
                        {
                            from.AddToBackpack(new ArmysPaeonScroll()); paperName = "army's paeon sheet music";
                        }
                        else if (paperType == 83)
                        {
                            from.AddToBackpack(new EnchantingEtudeScroll()); paperName = "enchanting etude sheet music";
                        }
                        else if (paperType == 84)
                        {
                            from.AddToBackpack(new EnergyCarolScroll()); paperName = "energy carol sheet music";
                        }
                        else if (paperType == 85)
                        {
                            from.AddToBackpack(new EnergyThrenodyScroll()); paperName = "energy threnody sheet music";
                        }
                        else if (paperType == 86)
                        {
                            from.AddToBackpack(new FireCarolScroll()); paperName = "fire carol sheet music";
                        }
                        else if (paperType == 87)
                        {
                            from.AddToBackpack(new FireThrenodyScroll()); paperName = "fire threnody sheet music";
                        }
                        else if (paperType == 88)
                        {
                            from.AddToBackpack(new FoeRequiemScroll()); paperName = "foe requiem sheet music";
                        }
                        else if (paperType == 89)
                        {
                            from.AddToBackpack(new IceCarolScroll()); paperName = "ice carol sheet music";
                        }
                        else if (paperType == 90)
                        {
                            from.AddToBackpack(new IceThrenodyScroll()); paperName = "ice threnody sheet music";
                        }
                        else if (paperType == 91)
                        {
                            from.AddToBackpack(new KnightsMinneScroll()); paperName = "knight's minne sheet music";
                        }
                        else if (paperType == 92)
                        {
                            from.AddToBackpack(new MagesBalladScroll()); paperName = "mage's ballad sheet music";
                        }
                        else if (paperType == 93)
                        {
                            from.AddToBackpack(new MagicFinaleScroll()); paperName = "magic finale sheet music";
                        }
                        else if (paperType == 94)
                        {
                            from.AddToBackpack(new PoisonCarolScroll()); paperName = "poison carol sheet music";
                        }
                        else if (paperType == 95)
                        {
                            from.AddToBackpack(new PoisonThrenodyScroll()); paperName = "poison threnody sheet music";
                        }
                        else if (paperType == 96)
                        {
                            from.AddToBackpack(new SheepfoeMamboScroll()); paperName = "shepherd's dance sheet music";
                        }
                        else
                        {
                            from.AddToBackpack(new SinewyEtudeScroll()); paperName = "sinewy etude sheet music";
                        }

                        from.SendMessage("This seems to be a scroll of " + paperName + ".");
                    }
                    else
                    {
                        string paperName = "useless scribbles";
                        switch (Utility.RandomMinMax(1, 6))
                        {
                        case 1: paperName = "useless scribbles"; break;

                        case 2: paperName = "a useless recipe"; break;

                        case 3: paperName = "a useless list of monsters"; break;

                        case 4: paperName = "useless writings"; break;

                        case 5: paperName = "a useless drawing"; break;

                        case 6: paperName = "a useless map"; break;
                        }
                        from.SendMessage("This seems to be " + paperName + ".");
                    }
                }
                else
                {
                    int nReaction = Utility.RandomMinMax(0, 10);

                    if (nReaction > 8)
                    {
                        from.FixedParticles(0x374A, 10, 15, 5021, EffectLayer.Waist);
                        from.PlaySound(0x205);
                        int nPoison = Utility.RandomMinMax(0, 10);
                        if (nPoison > 9)
                        {
                            from.ApplyPoison(from, Poison.Deadly);
                        }
                        else if (nPoison > 7)
                        {
                            from.ApplyPoison(from, Poison.Greater);
                        }
                        else if (nPoison > 4)
                        {
                            from.ApplyPoison(from, Poison.Regular);
                        }
                        else
                        {
                            from.ApplyPoison(from, Poison.Lesser);
                        }
                        from.SendMessage("You accidentally trigger a poison spell!");
                    }
                    else if (nReaction > 6)
                    {
                        from.FixedParticles(0x3709, 10, 30, 5052, EffectLayer.LeftFoot);
                        from.PlaySound(0x208);
                        Spells.SpellHelper.Damage(TimeSpan.FromSeconds(0.5), from, from, Utility.RandomMinMax(5, 40), 0, 100, 0, 0, 0);
                        from.SendMessage("You accidentally trigger a fire spell!");
                    }
                    else if (nReaction > 4)
                    {
                        from.FixedParticles(0x36BD, 20, 10, 5044, EffectLayer.Head);
                        from.PlaySound(0x307);
                        Spells.SpellHelper.Damage(TimeSpan.FromSeconds(0.5), from, from, Utility.RandomMinMax(5, 40), 0, 100, 0, 0, 0);
                        from.SendMessage("You accidentally trigger an explosion spell!");
                    }
                    else
                    {
                        from.SendMessage("Failing to read the scroll, you throw it out.");
                    }
                }
                examine.Delete();
            }
            /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            else if (examine is UnknownWand)
            {
                if (from.CheckTargetSkill(SkillName.ItemID, o, -5, 120) || automatic)
                {
                    Server.Items.UnknownWand.WandType(examine, from, from);
                }
                else
                {
                    int nReaction = Utility.RandomMinMax(0, 10);

                    if (nReaction > 6)
                    {
                        from.FixedParticles(0x3709, 10, 30, 5052, EffectLayer.LeftFoot);
                        from.PlaySound(0x208);
                        Spells.SpellHelper.Damage(TimeSpan.FromSeconds(0.5), from, from, Utility.RandomMinMax(5, 40), 0, 100, 0, 0, 0);
                        from.SendMessage("The wands bursts into flames!");
                    }
                    else if (nReaction > 4)
                    {
                        from.FixedParticles(0x36BD, 20, 10, 5044, EffectLayer.Head);
                        from.PlaySound(0x307);
                        Spells.SpellHelper.Damage(TimeSpan.FromSeconds(0.5), from, from, Utility.RandomMinMax(5, 40), 0, 100, 0, 0, 0);
                        from.SendMessage("The wand explodes in your hands!");
                    }
                    else
                    {
                        from.SendMessage("Failing to figure out the wand, you throw it out.");
                    }
                }
                examine.Delete();
            }
            /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            else if (examine is UnidentifiedArtifact)
            {
                UnidentifiedArtifact relic = (UnidentifiedArtifact)examine;

                if (relic.IDAttempt > 5 && !automatic)
                {
                    from.SendMessage("Only a vendor can identify this item now as too many attempts were made.");
                }
                else if (from.CheckTargetSkill(SkillName.ItemID, o, -5, 120) || automatic)
                {
                    Container   pack  = (Container)relic;
                    List <Item> items = new List <Item>();
                    foreach (Item item in pack.Items)
                    {
                        items.Add(item);
                    }
                    foreach (Item item in items)
                    {
                        from.AddToBackpack(item);
                    }

                    from.SendMessage("You successfully identify the artifact.");
                    relic.Delete();
                }
                else
                {
                    relic.IDAttempt = relic.IDAttempt + 1;
                    from.SendMessage("You can't seem to identify this artifact.");
                }
            }
            /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            else if (examine is UnidentifiedItem)
            {
                UnidentifiedItem relic = (UnidentifiedItem)examine;

                if (relic.IDAttempt > 5 && !automatic)
                {
                    from.SendMessage("Only a vendor can identify this item now as too many attempts were made.");
                }
                else if (relic.SkillRequired != "ItemID" && !automatic)
                {
                    from.SendMessage("You are using the wrong skill to figure this out.");
                }
                else if (from.CheckTargetSkill(SkillName.ItemID, o, -5, 120) || automatic)
                {
                    Container   pack  = (Container)relic;
                    List <Item> items = new List <Item>();
                    foreach (Item item in pack.Items)
                    {
                        items.Add(item);
                    }
                    foreach (Item item in items)
                    {
                        from.AddToBackpack(item);
                    }

                    from.SendMessage("You successfully identify the item.");
                    relic.Delete();
                }
                else
                {
                    relic.IDAttempt = relic.IDAttempt + 1;
                    from.SendMessage("You can't seem to identify this item.");
                }
            }
            /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            else if (Server.Misc.RelicItems.IsRelicItem(examine) == true)
            {
                from.SendMessage(Server.Misc.RelicItems.IdentifyRelicValue(from, from, examine));
            }
            /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            else if (o is Item)
            {
                if (o is BaseWeapon || o is BaseArmor)
                {
                    from.SendMessage("You will need to use arms lore on that type of item.");
                }
                else
                {
                    from.SendMessage("This item has already been examined by someone.");
                }
            }
            else if (o is Mobile)
            {
                ((Mobile)o).OnSingleClick(from);
            }
            else
            {
                from.SendLocalizedMessage(500353);                   // You are not certain...
            }
        }
Ejemplo n.º 17
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                // Use the same targetting logic as a regular dye tub, only with uses
                // decrementation (providing not just a color swatch)

                if (targeted is ColorSwatch)
                {
                    ColorSwatch cs = (ColorSwatch)targeted;
                    if (cs.Amount > 1)
                    {
                        cs.Amount--;
                        cs = null;

                        cs           = new ColorSwatch();
                        cs.Stackable = false;

                        from.AddToBackpack(cs);
                    }
                    cs.StoredColorName = m_Tub.StoredColorNamePrefix + "shade of " + m_Tub.StoredColorName;
                    cs.Hue             = m_Tub.Hue;
                }
                else if (targeted is Item)
                {
                    Item item = (Item)targeted;

                    if (item is BaseClothing)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                                          // That is too far away.
                        }
                        else if (!item.IsChildOf(from.Backpack))
                        {
                            from.SendMessage("The item you are dying must be in your backpack.");
                        }

                        else if (item.Parent is Mobile)
                        {
                            from.SendLocalizedMessage(500861);                                          // Can't Dye clothing that is being worn.
                        }
                        else if (((IDyable)item).Dye(from, m_Tub))
                        {
                            from.PlaySound(0x23E);
                            if (--m_Tub.m_Uses == 0)
                            {
                                m_Tub.Delete();
                                from.AddToBackpack(new DyeTub());
                            }

                            item.Hue = m_Tub.Hue;
                        }
                    }
                    else
                    {
                        from.SendMessage("You can only dye clothing with special dyes. You're trying to dye {0}", targeted);
                    }
                }
            }
Ejemplo n.º 18
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Item)
                {
                    Item item = (Item)targeted;

                    if (item is IDyable && m_Tub.AllowDyables)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (item.Parent is Mobile)
                        {
                            from.SendLocalizedMessage(500861);                               // Can't Dye clothing that is being worn.
                        }
                        else if (((IDyable)item).Dye(from, m_Tub))
                        {
                            from.PlaySound(0x23E);
                        }
                    }
                    else if (FurnitureAttribute.Check(item))
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else
                        {
                            bool okay = (item.IsChildOf(from.Backpack));

                            if (!okay)
                            {
                                if (item.Parent == null)
                                {
                                    BaseHouse house = BaseHouse.FindHouseAt(item);

                                    if (house == null || (!house.IsLockedDown(item) && !house.IsSecure(item)))
                                    {
                                        from.SendLocalizedMessage(501022);                                           // Furniture must be locked down to paint it.
                                    }
                                    else if (!house.IsCoOwner(from))
                                    {
                                        from.SendLocalizedMessage(501023);                                           // You must be the owner to use this item.
                                    }
                                    else
                                    {
                                        okay = true;
                                    }
                                }
                                else
                                {
                                    from.SendLocalizedMessage(1048135);                                       // The furniture must be in your backpack to be painted.
                                }
                            }

                            if (okay)
                            {
                                item.Hue = m_Tub.DyedHue;
                                from.PlaySound(0x23E);
                            }
                        }
                    }
                    else if ((item is Runebook || item is RecallRune) && m_Tub.AllowRunebooks)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1049776);                               // You cannot dye runes or runebooks that are locked down.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    else if (item is ILevelable ||
                             item is IGiftable ||
                             item is RibbonTree ||
                             item is RibbonTreeSmall ||
                             item is DragonOrbStatue ||
                             item is BaseBoatDeed ||
                             item is HouseDeed ||
                             item is HousePlacementTool ||
                             item is BaseDockedBoat ||
                             item is MagicCloak ||
                             item is MagicHat ||
                             item is Pillows ||
                             item is ResearchBag ||
                             item is ColoredWallTorch ||
                             item is MagicPigment ||
                             item is BaseQuiver ||
                             item is MagicBelt ||
                             item is MagicSash ||
                             item is MagicBoots ||
                             item is MagicRobe ||
                             item is HairDyeBottle ||
                             item is HairDyePotion ||
                             item is ThrowingGloves ||
                             item is BagOfTricks ||
                             item is LevelPugilistGloves ||
                             item is LevelThrowingGloves ||
                             item is GiftPugilistGloves ||
                             item is GiftThrowingGloves ||
                             item is PugilistGlove ||
                             item is PugilistGloves)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1042083);                               // You cannot dye that.
                        }
                        else if (item.Parent is Mobile)
                        {
                            from.SendLocalizedMessage(500861);                               // Can't Dye clothing that is being worn.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }

                        if ((item is BaseBoatDeed || item is BaseDockedBoat) && item.Hue < 1)
                        {
                            item.Hue = 0x5BE;
                        }
                    }
                    else if (item is DDRelicRugAddonDeed)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1042083);                               // You cannot dye that.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            DDRelicRugAddonDeed relic = (DDRelicRugAddonDeed)item;
                            relic.RelicColor = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    else if (item is HenchmanFamiliarItem || item is WaxPainting || item is WaxSculptors || item is WaxSculptorsD || item is WaxSculptorsE || item is ColorCandleShort || item is ColorCandleLong)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1042083);                               // You cannot dye that.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    else if ((item is MyTentEastAddonDeed) || (item is MyTentSouthAddonDeed))
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1042083);                               // You cannot dye that.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            if (item is MyTentEastAddonDeed)
                            {
                                MyTentEastAddonDeed tent = (MyTentEastAddonDeed)item; tent.TentColor = m_Tub.DyedHue;
                            }
                            else
                            {
                                MyTentSouthAddonDeed tent = (MyTentSouthAddonDeed)item; tent.TentColor = m_Tub.DyedHue;
                            }
                            from.PlaySound(0x23E);
                        }
                    }
                    else if ((item is MyCircusTentEastAddonDeed) || (item is MyCircusTentSouthAddonDeed))
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1042083);                               // You cannot dye that.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            if (item is MyCircusTentEastAddonDeed)
                            {
                                MyCircusTentEastAddonDeed tent = (MyCircusTentEastAddonDeed)item; tent.TentColor1 = m_Tub.DyedHue;
                            }
                            else
                            {
                                MyCircusTentSouthAddonDeed tent = (MyCircusTentSouthAddonDeed)item; tent.TentColor1 = m_Tub.DyedHue;
                            }
                            from.PlaySound(0x23E);
                        }
                    }
                    else if (item is MonsterStatuette && m_Tub.AllowStatuettes)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1049779);                               // You cannot dye statuettes that are locked down.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    else if (item is BaseArmor && (Server.Misc.MaterialInfo.IsAnyKindOfClothItem(item) || item is ElvenBoots) && m_Tub.AllowLeather)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1042419);                               // You may not dye leather items which are locked down.
                        }
                        else if (item.Parent is Mobile)
                        {
                            from.SendLocalizedMessage(500861);                               // Can't Dye clothing that is being worn.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    else if (item is BaseArmor && (Server.Misc.MaterialInfo.IsAnyKindOfMetalItem(item) || Server.Misc.MaterialInfo.IsAnyKindOfWoodItem(item)) && m_Tub.AllowArmor)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1042083);                               // You cannot dye that.
                        }
                        else if (item.Parent is Mobile)
                        {
                            from.SendMessage("Can't Dye armor that is equipped.");
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    else if (item is BaseWeapon && m_Tub.AllowWeapons)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446);                               // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1042083);                               // You cannot dye that.
                        }
                        else if (item.Parent is Mobile)
                        {
                            from.SendMessage("Can't Dye weapons that are equipped.");
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(m_Tub.FailMessage);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(m_Tub.FailMessage);
                }
            }
Ejemplo n.º 19
0
                protected override void OnTick()
                {
                    Item item = (Item)this.m_Item;

                    if (!this.m_From.InRange(item.GetWorldLocation(), 1))
                    {
                        return;
                    }

                    if (this.m_Item.LockLevel == 0 || this.m_Item.LockLevel == -255)
                    {
                        // LockLevel of 0 means that the door can't be picklocked
                        // LockLevel of -255 means it's magic locked
                        item.SendLocalizedMessageTo(this.m_From, 502073); // This lock cannot be picked by normal means
                        return;
                    }

                    if (m_From.Skills[SkillName.Lockpicking].Value < m_Item.RequiredSkill - m_Lockpick.SkillBonus)
                    {
                        /*
                         * // Do some training to gain skills
                         * m_From.CheckSkill( SkillName.Lockpicking, 0, m_Item.LockLevel );*/
                        // The LockLevel is higher thant the LockPicking of the player
                        item.SendLocalizedMessageTo(this.m_From, 502072); // You don't see how that lock can be manipulated.
                        return;
                    }

                    int maxlevel = m_Item.MaxLockLevel;
                    int minLevel = m_Item.LockLevel;

                    if (m_Item is Skeletonkey)
                    {
                        minLevel -= m_Lockpick.SkillBonus;
                        maxlevel -= m_Lockpick.SkillBonus; //regulars subtract the bonus from the max level
                    }

                    if (m_Lockpick is MasterSkeletonKey || m_From.CheckTargetSkill(SkillName.Lockpicking, m_Item, minLevel, maxlevel))
                    {
                        // Success! Pick the lock!
                        item.SendLocalizedMessageTo(this.m_From, 502076); // The lock quickly yields to your skill.
                        this.m_From.PlaySound(0x4A);
                        this.m_Item.LockPick(this.m_From);
                    }
                    else
                    {
                        // The player failed to pick the lock
                        this.BrokeLockPickTest();
                        item.SendLocalizedMessageTo(this.m_From, 502075); // You are unable to pick the lock.

                        if (item is TreasureMapChest && ((Container)item).Items.Count > 0 && 0.25 > Utility.RandomDouble())
                        {
                            Container cont = (Container)item;

                            Item toBreak = cont.Items[Utility.Random(cont.Items.Count)];

                            if (!(toBreak is Container))
                            {
                                toBreak.Delete();
                                Effects.PlaySound(item.Location, item.Map, 0x1DE);
                                m_From.SendMessage(0x20, "The sound of gas escaping is heard from the chest.");
                            }
                        }
                    }
                }
Ejemplo n.º 20
0
        protected virtual void EndLockpick(object state)
        {
            object[]      objs         = (object[])state;
            ILockpickable lockpickable = objs[0] as ILockpickable;
            Mobile        from         = objs[1] as Mobile;

            Item item = (Item)lockpickable;

            if (!from.InRange(item.GetWorldLocation(), 1))
            {
                return;
            }

            if (lockpickable.LockLevel == 0 || lockpickable.LockLevel == -255)
            {
                // LockLevel of 0 means that the door can't be picklocked
                // LockLevel of -255 means it's magic locked
                item.SendLocalizedMessageTo(from, 502073); // This lock cannot be picked by normal means
                return;
            }

            if (from.Skills[SkillName.Lockpicking].Value < lockpickable.RequiredSkill - SkillBonus)
            {
                /*
                 * // Do some training to gain skills
                 * from.CheckSkill( SkillName.Lockpicking, 0, lockpickable.LockLevel );*/
                // The LockLevel is higher thant the LockPicking of the player
                item.SendLocalizedMessageTo(from, 502072); // You don't see how that lock can be manipulated.
                return;
            }

            int maxlevel = lockpickable.MaxLockLevel;
            int minLevel = lockpickable.LockLevel;

            if (lockpickable is Skeletonkey)
            {
                minLevel -= SkillBonus;
                maxlevel -= SkillBonus; //regulars subtract the bonus from the max level
            }

            if (this is MasterSkeletonKey || from.CheckTargetSkill(SkillName.Lockpicking, lockpickable, minLevel, maxlevel))
            {
                // Success! Pick the lock!
                OnUse();

                item.SendLocalizedMessageTo(from, 502076); // The lock quickly yields to your skill.
                from.PlaySound(0x4A);
                lockpickable.LockPick(from);
            }
            else
            {
                // The player failed to pick the lock
                BrokeLockPickTest(from);
                item.SendLocalizedMessageTo(from, 502075); // You are unable to pick the lock.

                if (item is TreasureMapChest && ((Container)item).Items.Count > 0 && 0.25 > Utility.RandomDouble())
                {
                    Container cont = (Container)item;

                    Item toBreak = cont.Items[Utility.Random(cont.Items.Count)];

                    if (!(toBreak is Container))
                    {
                        toBreak.Delete();
                        Effects.PlaySound(item.Location, item.Map, 0x1DE);
                        from.SendMessage(0x20, "The sound of gas escaping is heard from the chest.");
                    }
                }
            }
        }
Ejemplo n.º 21
0
        public virtual void Fill_OnTarget(Mobile from, object targ)
        {
            if (!IsEmpty || !Fillable || !ValidateUse(from, false))
            {
                return;
            }

            if (targ is BaseBeverage)
            {
                BaseBeverage bev = (BaseBeverage)targ;

                if (bev.IsEmpty || !bev.ValidateUse(from, true))
                {
                    return;
                }

                this.Content  = bev.Content;
                this.Poison   = bev.Poison;
                this.Poisoner = bev.Poisoner;

                if (bev.Quantity > this.MaxQuantity)
                {
                    this.Quantity = this.MaxQuantity;
                    bev.Quantity -= this.MaxQuantity;
                }
                else
                {
                    this.Quantity += bev.Quantity;
                    bev.Quantity   = 0;
                }
            }
            else if (targ is BaseWaterContainer)
            {
                BaseWaterContainer bwc = targ as BaseWaterContainer;

                if (Quantity == 0 || (this.Content == BeverageType.Water && !this.IsFull))
                {
                    int I_Need = Math.Min((MaxQuantity - Quantity), bwc.Quantity);

                    if ((I_Need > 0) && !bwc.IsEmpty && !IsFull)
                    {
                        bwc.Quantity -= I_Need;
                        Quantity     += I_Need;
                        Content       = BeverageType.Water;

                        from.PlaySound(0x4E);
                    }
                }
            }
            else if (targ is Item)
            {
                Item         item = (Item)targ;
                IWaterSource src;

                src = (item as IWaterSource);

                if (src == null && item is AddonComponent)
                {
                    src = (((AddonComponent)item).Addon as IWaterSource);
                }

                if (src == null || src.Quantity <= 0)
                {
                    return;
                }

                if (from.Map != item.Map || !from.InRange(item.GetWorldLocation(), 2) || !from.InLOS(item))
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045);                       // I can't reach that.
                    return;
                }

                this.Content  = BeverageType.Water;
                this.Poison   = null;
                this.Poisoner = null;

                if (src.Quantity > this.MaxQuantity)
                {
                    this.Quantity = this.MaxQuantity;
                    src.Quantity -= this.MaxQuantity;
                }
                else
                {
                    this.Quantity += src.Quantity;
                    src.Quantity   = 0;
                }

                from.SendLocalizedMessage(1010089);                   // You fill the container with water.
            }
            else if (targ is StaticTarget)
            {
                StaticTarget src = (StaticTarget)targ;

                if (src == null)
                {
                    return;
                }

                if (src.ItemID >= 2881 && src.ItemID <= 2884 || src.ItemID == 3707 || src.ItemID == 5453 || src.ItemID >= 13549 && src.ItemID <= 13608)
                {
                    if (!from.InRange(src.Location, 2) || !from.InLOS(src))
                    {
                        from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045);                         // I can't reach that.
                        return;
                    }

                    this.Content  = BeverageType.Water;
                    this.Poison   = null;
                    this.Poisoner = null;
                    this.Quantity = this.MaxQuantity;

                    from.SendLocalizedMessage(1010089); // You fill the container with water.
                }
            }                                           ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            else if (targ is Cow)
            {
                Cow cow = (Cow)targ;

                if (cow.TryMilk(from))
                {
                    Content  = BeverageType.Milk;
                    Quantity = MaxQuantity;
                    from.SendLocalizedMessage(1080197);                       // You fill the container with milk.
                }
            }
        }
Ejemplo n.º 22
0
 public static Region GetRegion(this Item item)
 {
     return(Region.Find(item.GetWorldLocation(), item.Map));
 }
Ejemplo n.º 23
0
		private void DestroyFurniture( Mobile from, Item item )
		{
			if ( !from.InRange( item.GetWorldLocation(), 3 ) || !from.InLOS(item) )
			{
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
				return;
			}
		    if ( !item.IsChildOf( from.Backpack ) && !item.Movable )
		    {
		        from.SendLocalizedMessage( 500462 ); // You can't destroy that while it is here.
		        return;
		    }

		    from.SendLocalizedMessage( 500461 ); // You destroy the item.
			Effects.PlaySound( item.GetWorldLocation(), item.Map, 0x3B3 );

			if ( item is Container )
			{
				if ( item is TrapableContainer )
					(item as TrapableContainer).ExecuteTrap( from );

				((Container)item).Destroy();
			}
			else
			{
				item.Delete();
			}
		}
Ejemplo n.º 24
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID == 0)               // Cancel
            {
                return;
            }
            else if (m_Mobile.Deleted || m_Moongate.Deleted || m_Mobile.Map == null)
            {
                return;
            }

            int[] switches = info.Switches;

            if (switches.Length == 0)
            {
                return;
            }

            int switchID  = switches[0];
            int listIndex = switchID / 100;
            int listEntry = switchID % 100;

            if (listIndex < 0 || listIndex >= m_Lists.Length)
            {
                return;
            }

            PMList list = m_Lists[listIndex];

            if (listEntry < 0 || listEntry >= list.Entries.Length)
            {
                return;
            }

            PMEntry entry = list.Entries[listEntry];

            if (!m_Mobile.InRange(m_Moongate.GetWorldLocation(), 1) || m_Mobile.Map != m_Moongate.Map)
            {
                m_Mobile.SendLocalizedMessage(1019002);                   // You are too far away to use the gate.
            }
            else if (m_Mobile.Player && m_Mobile.Kills >= 5 && list.Map != Map.Felucca)
            {
                m_Mobile.SendLocalizedMessage(1019004);                   // You are not allowed to travel there.
            }
            else if (Factions.Sigil.ExistsOn(m_Mobile) && list.Map != Factions.Faction.Facet)
            {
                m_Mobile.SendLocalizedMessage(1019004);                   // You are not allowed to travel there.
            }
            else if (m_Mobile.Criminal)
            {
                m_Mobile.SendLocalizedMessage(1005561, "", 0x22);                   // Thou'rt a criminal and cannot escape so easily.
            }
            else if (Server.Spells.SpellHelper.CheckCombat(m_Mobile))
            {
                m_Mobile.SendLocalizedMessage(1005564, "", 0x22);                   // Wouldst thou flee during the heat of battle??
            }
            else if (m_Mobile.Spell != null)
            {
                m_Mobile.SendLocalizedMessage(1049616);                   // You are too busy to do that at the moment.
            }
            else if (m_Mobile.Map == list.Map && m_Mobile.InRange(entry.Location, 1))
            {
                m_Mobile.SendLocalizedMessage(1019003);                   // You are already there.
            }
            else
            {
                BaseCreature.TeleportPets(m_Mobile, entry.Location, list.Map);

                m_Mobile.Combatant = null;
                m_Mobile.Warmode   = false;
                m_Mobile.Hidden    = true;

                m_Mobile.MoveToWorld(entry.Location, list.Map);

                Effects.PlaySound(entry.Location, list.Map, 0x1FE);
            }
        }
Ejemplo n.º 25
0
            protected override void OnTarget(Mobile from, object o)
            {
                if (o is Item)
                {
                    string        runes       = null;
                    StringBuilder translation = new StringBuilder();

                    Item item = o as Item;
                    if (from.InRange(item.GetWorldLocation(), 1))
                    {
                        if (from.CheckTargetSkill(SkillName.ItemID, o, 50, 100))
                        {
                            if (from.Skills.ItemID.Value > 35)
                            {
                                if (item.Weight >= 1 && item.Amount > 1)
                                {
                                    double pounds = (double)(item.Weight / 2);
                                    from.SendMessage("You'd estimate this objects invdividual weight at {0} pounds.", pounds);
                                }

                                if (item.Weight >= 1 && item.Amount == 1)
                                {
                                    double pounds = (double)(item.Weight / 2);
                                    from.SendMessage("You'd estimate this objects weight at {0} pounds.", pounds);
                                }

                                if (item.Weight < 1)
                                {
                                    from.SendMessage("You need a scale to accurately gauge this item's weight.");
                                }
                            }

                            if (o is BaseWeapon)
                            {
                                BaseWeapon weapon = o as BaseWeapon;

                                if (from.Skills.ItemID.Value > 65)
                                {
                                    if (weapon.Attributes.AttackChance != 0)
                                    {
                                        runes += "AZE";
                                        if (from.Skills.Inscribe.Value > 65)
                                        {
                                            translation.AppendFormat("Accuracy Bonus: +{0}\n", weapon.Attributes.AttackChance.ToString());
                                        }
                                    }

                                    if (weapon.Attributes.DefendChance != 0)
                                    {
                                        runes += "BYZ";
                                        if (from.Skills.Inscribe.Value > 65)
                                        {
                                            translation.AppendFormat("Evasion Bonus: +{0}\n", weapon.Attributes.DefendChance.ToString());
                                        }
                                    }

                                    if (weapon.Attributes.WeaponDamage != 0)
                                    {
                                        runes += "CXS";
                                        if (from.Skills.Inscribe.Value > 65)
                                        {
                                            translation.AppendFormat("Damage Bonus: +{0}\n", weapon.Attributes.WeaponDamage.ToString());
                                        }
                                    }
                                }

                                if (from.Skills.ItemID.Value > 75)
                                {
                                    if (weapon.Attributes.WeaponSpeed != 0)
                                    {
                                        runes += "DWE";
                                        if (from.Skills.Inscribe.Value > 75)
                                        {
                                            translation.AppendFormat("Speed Bonus: +{0}\n", weapon.Attributes.WeaponSpeed.ToString());
                                        }
                                    }

                                    if (weapon.Attributes.SpellDamage != 0)
                                    {
                                        runes += "EVE";
                                        if (from.Skills.Inscribe.Value > 75)
                                        {
                                            translation.AppendFormat("Spell Damage Bonus: +{0}\n", weapon.Attributes.SpellDamage.ToString());
                                        }
                                    }

                                    if (weapon.WeaponAttributes.HitLowerAttack != 0)
                                    {
                                        runes += "ADF";
                                        if (from.Skills.Inscribe.Value > 75)
                                        {
                                            translation.AppendFormat("Break Attack: {0}\n", weapon.WeaponAttributes.HitLowerAttack.ToString());
                                        }
                                    }

                                    if (weapon.WeaponAttributes.HitLowerDefend != 0)
                                    {
                                        runes += "FVS";
                                        if (from.Skills.Inscribe.Value > 75)
                                        {
                                            translation.AppendFormat("Break Defense: {0}\n", weapon.WeaponAttributes.HitLowerDefend.ToString());
                                        }
                                    }
                                }

                                if (from.Skills.ItemID.Value > 80)
                                {
                                    if (weapon.Attributes.BonusStam != 0)
                                    {
                                        runes += "FUW";
                                        if (from.Skills.Inscribe.Value > 80)
                                        {
                                            translation.AppendFormat("Bonus Stam: {0}\n", weapon.Attributes.BonusStam.ToString());
                                        }
                                    }

                                    if (weapon.Attributes.BonusHits != 0)
                                    {
                                        runes += "GTA";
                                        if (from.Skills.Inscribe.Value > 80)
                                        {
                                            translation.AppendFormat("Bonus Hits: {0}\n", weapon.Attributes.BonusHits.ToString());
                                        }
                                    }

                                    if (weapon.Attributes.BonusMana != 0)
                                    {
                                        runes += "HHS";
                                        if (from.Skills.Inscribe.Value > 80)
                                        {
                                            translation.AppendFormat("Bonus Mana: {0}\n", weapon.Attributes.BonusMana.ToString());
                                        }
                                    }

                                    if (weapon.Attributes.BonusDex != 0)
                                    {
                                        runes += "IRA";
                                        if (from.Skills.Inscribe.Value > 80)
                                        {
                                            translation.AppendFormat("Bonus Dex: {0}\n", weapon.Attributes.BonusDex.ToString());
                                        }
                                    }

                                    if (weapon.Attributes.BonusStr != 0)
                                    {
                                        runes += "JQA";
                                        if (from.Skills.Inscribe.Value > 80)
                                        {
                                            translation.AppendFormat("Bonus Str: {0}\n", weapon.Attributes.BonusStr.ToString());
                                        }
                                    }

                                    if (weapon.Attributes.BonusInt != 0)
                                    {
                                        runes += "KPL";
                                        if (from.Skills.Inscribe.Value > 80)
                                        {
                                            translation.AppendFormat("Bonus Int: {0}\n", weapon.Attributes.BonusInt.ToString());
                                        }
                                    }
                                }

                                if (from.Skills.ItemID.Value > 85)
                                {
                                    if (weapon.Attributes.LowerManaCost != 0)
                                    {
                                        runes += "LOL";
                                        if (from.Skills.Inscribe.Value > 85)
                                        {
                                            translation.AppendFormat("Lower Mana Cost: {0\n}%", weapon.Attributes.LowerManaCost.ToString());
                                        }
                                    }
                                }

                                if (from.Skills.ItemID.Value > 90)
                                {
                                    if (weapon.WeaponAttributes.HitColdArea != 0)
                                    {
                                        runes += "MNT";
                                        if (from.Skills.Inscribe.Value > 90)
                                        {
                                            translation.AppendFormat("Frost Radius ({0}%)\n", weapon.WeaponAttributes.HitColdArea.ToString());
                                        }
                                    }

                                    if (weapon.WeaponAttributes.HitDispel != 0)
                                    {
                                        runes += "NKA";
                                        if (from.Skills.Inscribe.Value > 90)
                                        {
                                            translation.AppendFormat("Hit Dispel ({0})\n", weapon.WeaponAttributes.HitDispel.ToString());
                                        }
                                    }

                                    if (weapon.WeaponAttributes.HitEnergyArea != 0)
                                    {
                                        runes += "ONN";
                                        if (from.Skills.Inscribe.Value > 90)
                                        {
                                            translation.AppendFormat("Shock Radius ({0}%)\n", weapon.WeaponAttributes.HitEnergyArea.ToString());
                                        }
                                    }

                                    if (weapon.WeaponAttributes.HitPoisonArea != 0)
                                    {
                                        runes += "PQA";
                                        if (from.Skills.Inscribe.Value > 90)
                                        {
                                            translation.AppendFormat("Corrosion Radius ({0}%)\n", weapon.WeaponAttributes.HitPoisonArea.ToString());
                                        }
                                    }

                                    if (weapon.WeaponAttributes.HitFireArea != 0)
                                    {
                                        runes += "QRQ";
                                        if (from.Skills.Inscribe.Value > 90)
                                        {
                                            translation.AppendFormat("Burn Radius ({0}%)\n", weapon.WeaponAttributes.HitFireArea.ToString());
                                        }
                                    }

                                    if (weapon.WeaponAttributes.HitPhysicalArea != 0)
                                    {
                                        runes += "RSS";
                                        if (from.Skills.Inscribe.Value > 90)
                                        {
                                            translation.AppendFormat("Physical Area Hit ({0})\n", weapon.WeaponAttributes.HitPhysicalArea.ToString());
                                        }
                                    }

                                    if (weapon.WeaponAttributes.HitHarm != 0)
                                    {
                                        runes += "STZ";
                                        if (from.Skills.Inscribe.Value > 90)
                                        {
                                            translation.AppendFormat("Hit Harm ({0})\n", weapon.WeaponAttributes.HitHarm.ToString());
                                        }
                                    }

                                    if (weapon.WeaponAttributes.HitFireball != 0)
                                    {
                                        runes += "TBS";
                                        if (from.Skills.Inscribe.Value > 90)
                                        {
                                            translation.AppendFormat("Hit Fireball ({0})\n", weapon.WeaponAttributes.HitFireball.ToString());
                                        }
                                    }

                                    if (weapon.WeaponAttributes.HitMagicArrow != 0)
                                    {
                                        runes += "UDD";
                                        if (from.Skills.Inscribe.Value > 90)
                                        {
                                            translation.AppendFormat("Hit Magic Arrow ({0})\n", weapon.WeaponAttributes.HitMagicArrow.ToString());
                                        }
                                    }

                                    if (weapon.WeaponAttributes.HitLightning != 0)
                                    {
                                        runes += "VSD";
                                        if (from.Skills.Inscribe.Value > 90)
                                        {
                                            translation.AppendFormat("Hit Lightning ({0})\n", weapon.WeaponAttributes.HitLightning.ToString());
                                        }
                                    }
                                }

                                if (from.Skills.ItemID.Value > 95)
                                {
                                    if (weapon.WeaponAttributes.HitLeechHits != 0)
                                    {
                                        runes += "WXS";
                                        if (from.Skills.Inscribe.Value > 95)
                                        {
                                            translation.AppendFormat("Hit Life Leech ({0})\n", weapon.WeaponAttributes.HitLeechHits.ToString());
                                        }
                                    }

                                    if (weapon.WeaponAttributes.HitLeechStam != 0)
                                    {
                                        runes += "BXY";
                                        if (from.Skills.Inscribe.Value > 95)
                                        {
                                            translation.AppendFormat("Hit Stamina Leech ({0})\n", weapon.WeaponAttributes.HitLeechStam.ToString());
                                        }
                                    }

                                    if (weapon.WeaponAttributes.HitLeechMana != 0)
                                    {
                                        runes += "YAZ";
                                        if (from.Skills.Inscribe.Value > 95)
                                        {
                                            translation.AppendFormat("Hit Mana Leech ({0})\n", weapon.WeaponAttributes.HitLeechMana.ToString());
                                        }
                                    }
                                }

                                if ((!weapon.WeaponAttributes.IsEmpty) || (!weapon.Attributes.IsEmpty && runes != null))
                                {
                                    from.SendMessage("Runic Symbols:");
                                    from.Send(new AsciiMessage(Serial.MinusOne, -1, MessageType.Regular, 1152, 8, "Runes", runes));

                                    if (from.Skills.Inscribe.Value > 65)
                                    {
                                        from.SendMessage("\nYour skill in inscription allows you to decode some of the runes:");
                                        from.SendMessage(translation.ToString());
                                    }
                                }
                            }

                            if (o is BaseArmor)
                            {
                                BaseArmor armor = o as BaseArmor;

                                if (from.Skills.ItemID.Value > 65)
                                {
                                    if (armor.Attributes.AttackChance != 0)
                                    {
                                        runes += "AZS";
                                        if (from.Skills.Inscribe.Value > 65)
                                        {
                                            translation.AppendFormat("Accuracy Bonus: +{0}\n", armor.Attributes.AttackChance.ToString());
                                        }
                                    }

                                    if (armor.Attributes.DefendChance != 0)
                                    {
                                        runes += "BYZ";
                                        if (from.Skills.Inscribe.Value > 65)
                                        {
                                            translation.AppendFormat("Evasion Bonus: +{0}\n", armor.Attributes.DefendChance.ToString());
                                        }
                                    }

                                    if (armor.Attributes.WeaponDamage != 0)
                                    {
                                        runes += "CXS";
                                        if (from.Skills.Inscribe.Value > 65)
                                        {
                                            translation.AppendFormat("Weapon Damage: +{0}\n", armor.Attributes.WeaponDamage.ToString());
                                        }
                                    }
                                }

                                if (from.Skills.ItemID.Value > 75)
                                {
                                    if (armor.Attributes.WeaponSpeed != 0)
                                    {
                                        runes += "DMW";
                                        if (from.Skills.Inscribe.Value > 75)
                                        {
                                            translation.AppendFormat("Weapon Speed: +{0}\n", armor.Attributes.WeaponSpeed.ToString());
                                        }
                                    }

                                    if (armor.Attributes.SpellDamage != 0)
                                    {
                                        runes += "EUL";
                                        if (from.Skills.Inscribe.Value > 75)
                                        {
                                            translation.AppendFormat("Spell Damage: +{0}\n", armor.Attributes.SpellDamage.ToString());
                                        }
                                    }
                                }

                                if (from.Skills.ItemID.Value > 80)
                                {
                                    if (armor.Attributes.BonusStam != 0)
                                    {
                                        runes += "FSV";
                                        if (from.Skills.Inscribe.Value > 80)
                                        {
                                            translation.AppendFormat("Bonus Stam: {0}\n", armor.Attributes.BonusStam.ToString());
                                        }
                                    }

                                    if (armor.Attributes.BonusHits != 0)
                                    {
                                        runes += "GKB";
                                        if (from.Skills.Inscribe.Value > 65)
                                        {
                                            translation.AppendFormat("Bonus Hits: {0}\n", armor.Attributes.BonusHits.ToString());
                                        }
                                    }

                                    if (armor.Attributes.BonusMana != 0)
                                    {
                                        runes += "HJK";
                                        if (from.Skills.Inscribe.Value > 80)
                                        {
                                            translation.AppendFormat("Bonus Mana: {0}\n", armor.Attributes.BonusMana.ToString());
                                        }
                                    }

                                    if (armor.Attributes.BonusDex != 0)
                                    {
                                        runes += "IQS";
                                        if (from.Skills.Inscribe.Value > 80)
                                        {
                                            translation.AppendFormat("Bonus Dex: {0}\n", armor.Attributes.BonusDex.ToString());
                                        }
                                    }

                                    if (armor.Attributes.BonusStr != 0)
                                    {
                                        runes += "JKH";
                                        if (from.Skills.Inscribe.Value > 80)
                                        {
                                            translation.AppendFormat("Bonus Str: {0}\n", armor.Attributes.BonusStr.ToString());
                                        }
                                    }

                                    if (armor.Attributes.BonusInt != 0)
                                    {
                                        runes += "KLD";
                                        if (from.Skills.Inscribe.Value > 80)
                                        {
                                            translation.AppendFormat("Bonus Int: {0}\n", armor.Attributes.BonusInt.ToString());
                                        }
                                    }
                                }

                                if (from.Skills.ItemID.Value > 85)
                                {
                                    if (armor.Attributes.LowerManaCost != 0)
                                    {
                                        runes += "LMN";
                                        if (from.Skills.Inscribe.Value > 80)
                                        {
                                            translation.AppendFormat("Lower Mana Cost: {0}%\n", armor.Attributes.LowerManaCost.ToString());
                                        }
                                    }
                                }

                                if (!(armor.Attributes.IsEmpty) && runes != null)
                                {
                                    from.SendMessage("Runic Symbols:");
                                    from.Send(new AsciiMessage(Serial.MinusOne, -1, MessageType.Regular, 1152, 8, "Runes", runes));

                                    if (from.Skills.Inscribe.Value > 65)
                                    {
                                        from.SendMessage("Your skill in inscription allows you to decode some of the runes:");
                                        from.SendMessage(translation.ToString());
                                    }
                                }
                            }

                            if (o is BaseJewel)
                            {
                                BaseJewel jewel = o as BaseJewel;

                                if (from.Skills.ItemID.Value > 65)
                                {
                                    if (jewel.Attributes.AttackChance != 0)
                                    {
                                        runes += "AZN";
                                        if (from.Skills.Inscribe.Value > 65)
                                        {
                                            translation.AppendFormat("Accuracy Bonus: +{0}\n", jewel.Attributes.AttackChance.ToString());
                                        }
                                    }

                                    if (jewel.Attributes.DefendChance != 0)
                                    {
                                        runes += "BXS";
                                        if (from.Skills.Inscribe.Value > 65)
                                        {
                                            translation.AppendFormat("Evasion Bonus: +{0}\n", jewel.Attributes.DefendChance.ToString());
                                        }
                                    }

                                    if (jewel.Attributes.WeaponDamage != 0)
                                    {
                                        runes += "CYE";
                                        if (from.Skills.Inscribe.Value > 65)
                                        {
                                            translation.AppendFormat("Weapon Damage: +{0}\n", jewel.Attributes.WeaponDamage.ToString());
                                        }
                                    }
                                }

                                if (from.Skills.ItemID.Value > 75)
                                {
                                    if (jewel.Attributes.WeaponSpeed != 0)
                                    {
                                        runes += "DUL";
                                        if (from.Skills.Inscribe.Value > 75)
                                        {
                                            translation.AppendFormat("Weapon Speed: +{0}\n", jewel.Attributes.WeaponSpeed.ToString());
                                        }
                                    }

                                    if (jewel.Attributes.SpellDamage != 0)
                                    {
                                        runes += "EVA";
                                        if (from.Skills.Inscribe.Value > 75)
                                        {
                                            translation.AppendFormat("Spell Damage: +{0}\n", jewel.Attributes.SpellDamage.ToString());
                                        }
                                    }
                                }

                                if (from.Skills.ItemID.Value > 80)
                                {
                                    if (jewel.Attributes.BonusStam != 0)
                                    {
                                        runes += "FSF";
                                        if (from.Skills.Inscribe.Value > 80)
                                        {
                                            translation.AppendFormat("Bonus Stam: {0}\n", jewel.Attributes.BonusStam.ToString());
                                        }
                                    }
                                    if (jewel.Attributes.BonusHits != 0)
                                    {
                                        runes += "GBA";
                                        if (from.Skills.Inscribe.Value > 80)
                                        {
                                            translation.AppendFormat("Bonus Hits: {0}\n", jewel.Attributes.BonusHits.ToString());
                                        }
                                    }

                                    if (jewel.Attributes.BonusMana != 0)
                                    {
                                        runes += "HKG";
                                        if (from.Skills.Inscribe.Value > 80)
                                        {
                                            translation.AppendFormat("Bonus Mana: {0}\n", jewel.Attributes.BonusMana.ToString());
                                        }
                                    }

                                    if (jewel.Attributes.BonusDex != 0)
                                    {
                                        runes += "IDA";
                                        if (from.Skills.Inscribe.Value > 80)
                                        {
                                            translation.AppendFormat("Bonus Dex: {0}\n", jewel.Attributes.BonusDex.ToString());
                                        }
                                    }

                                    if (jewel.Attributes.BonusStr != 0)
                                    {
                                        runes += "KSS";
                                        if (from.Skills.Inscribe.Value > 80)
                                        {
                                            translation.AppendFormat("Bonus Str: {0}\n", jewel.Attributes.BonusStr.ToString());
                                        }
                                    }

                                    if (jewel.Attributes.BonusInt != 0)
                                    {
                                        runes += "LQL";
                                        if (from.Skills.Inscribe.Value > 80)
                                        {
                                            translation.AppendFormat("Bonus Int: {0}\n", jewel.Attributes.BonusInt.ToString());
                                        }
                                    }
                                }

                                if (from.Skills.ItemID.Value > 85)
                                {
                                    if (jewel.Attributes.LowerManaCost != 0)
                                    {
                                        runes += "MTN";
                                        if (from.Skills.Inscribe.Value > 65)
                                        {
                                            translation.AppendFormat("Lower Mana Cost: {0}%\n", jewel.Attributes.LowerManaCost.ToString());
                                        }
                                    }
                                }


                                if (!jewel.Attributes.IsEmpty)
                                {
                                    from.SendMessage("Runic Symbols:");
                                    from.Send(new AsciiMessage(Serial.MinusOne, -1, MessageType.Regular, 1152, 8, "Runes", runes));

                                    if (from.Skills.Inscribe.Value > 65)
                                    {
                                        from.SendMessage("\nYour skill in inscription allows you to decode some of the runes:");
                                        from.SendMessage(translation.ToString());
                                    }
                                }
                            }

                            if (o is BaseClothing)
                            {
                                BaseClothing clothes = o as BaseClothing;

                                if (from.Skills.ItemID.Value > 65)
                                {
                                    if (clothes.Attributes.AttackChance != 0)
                                    {
                                        runes += "AZR";
                                        if (from.Skills.Inscribe.Value > 65)
                                        {
                                            translation.AppendFormat("Accuracy Bonus: +{0}\n", clothes.Attributes.AttackChance.ToString());
                                        }
                                    }

                                    if (clothes.Attributes.DefendChance != 0)
                                    {
                                        runes += "BYE";
                                        if (from.Skills.Inscribe.Value > 65)
                                        {
                                            translation.AppendFormat("Evasion Bonus: +{0}\n", clothes.Attributes.DefendChance.ToString());
                                        }
                                    }

                                    if (clothes.Attributes.WeaponDamage != 0)
                                    {
                                        runes += "CXS";
                                        if (from.Skills.Inscribe.Value > 65)
                                        {
                                            translation.AppendFormat("Weapon Damage: +{0}\n", clothes.Attributes.WeaponDamage.ToString());
                                        }
                                    }
                                }

                                if (from.Skills.ItemID.Value > 75)
                                {
                                    if (clothes.Attributes.WeaponSpeed != 0)
                                    {
                                        runes += "DMV";
                                        if (from.Skills.Inscribe.Value > 75)
                                        {
                                            translation.AppendFormat("Weapon Speed: +{0}\n", clothes.Attributes.WeaponSpeed.ToString());
                                        }
                                    }

                                    if (clothes.Attributes.SpellDamage != 0)
                                    {
                                        runes += "EUR";
                                        if (from.Skills.Inscribe.Value > 75)
                                        {
                                            translation.AppendFormat("Spell Damage: +{0}\n", clothes.Attributes.SpellDamage.ToString());
                                        }
                                    }
                                }

                                if (from.Skills.ItemID.Value > 80)
                                {
                                    if (clothes.Attributes.BonusStam != 0)
                                    {
                                        runes += "FTL";
                                        if (from.Skills.Inscribe.Value > 80)
                                        {
                                            translation.AppendFormat("Bonus Stam: {0}\n", clothes.Attributes.BonusStam.ToString());
                                        }
                                    }
                                    if (clothes.Attributes.BonusHits != 0)
                                    {
                                        runes += "GHB";
                                        if (from.Skills.Inscribe.Value > 80)
                                        {
                                            translation.AppendFormat("Bonus Hits: {0}\n", clothes.Attributes.BonusHits.ToString());
                                        }
                                    }
                                    if (clothes.Attributes.BonusMana != 0)
                                    {
                                        runes += "HTA";
                                        if (from.Skills.Inscribe.Value > 80)
                                        {
                                            translation.AppendFormat("Bonus Mana: {0}\n", clothes.Attributes.BonusMana.ToString());
                                        }
                                    }
                                    if (clothes.Attributes.BonusDex != 0)
                                    {
                                        runes += "IQL";
                                        if (from.Skills.Inscribe.Value > 80)
                                        {
                                            translation.AppendFormat("Bonus Dex: {0}\n", clothes.Attributes.BonusDex.ToString());
                                        }
                                    }
                                    if (clothes.Attributes.BonusStr != 0)
                                    {
                                        runes += "JHA";
                                        if (from.Skills.Inscribe.Value > 80)
                                        {
                                            translation.AppendFormat("Bonus Str: {0}\n", clothes.Attributes.BonusStr.ToString());
                                        }
                                    }
                                    if (clothes.Attributes.BonusInt != 0)
                                    {
                                        runes += "KNO";
                                        if (from.Skills.Inscribe.Value > 80)
                                        {
                                            translation.AppendFormat("Bonus Int: {0}\n", clothes.Attributes.BonusInt.ToString());
                                        }
                                    }
                                }

                                if (from.Skills.ItemID.Value > 85)
                                {
                                    if (clothes.Attributes.LowerManaCost != 0)
                                    {
                                        runes += "LPL";
                                        if (from.Skills.Inscribe.Value > 85)
                                        {
                                            translation.AppendFormat("Lower Mana Cost: {0}%\n", clothes.Attributes.LowerManaCost.ToString());
                                        }
                                    }
                                }

                                if (!clothes.Attributes.IsEmpty && runes != null)
                                {
                                    from.SendMessage("Runic Symbols:");
                                    from.Send(new AsciiMessage(Serial.MinusOne, -1, MessageType.Regular, 1152, 8, "Runes", runes));

                                    if (from.Skills.Inscribe.Value > 65)
                                    {
                                        from.SendMessage("\nYour skill in inscription allows you to decode some of the runes:");
                                        from.SendMessage(translation.ToString());
                                    }
                                }
                            }
                        }

                        else
                        {
                            from.SendLocalizedMessage(500353); // You are not certain...
                        }
                    }
                    else
                    {
                        from.SendMessage("You are too far away.");
                    }
                }

                else if (o is Mobile)
                {
                    ((Mobile)o).OnSingleClick(from);
                }

                else
                {
                    from.SendLocalizedMessage(500353); // You are not certain...
                }

                EventSink.InvokeSkillUsed(new SkillUsedEventArgs(from, from.Skills[SkillName.ItemID]));
            }
Ejemplo n.º 26
0
        public virtual void Fill_OnTarget(Mobile from, object targ)
        {
            if (!IsEmpty || !Fillable || !ValidateUse(from, false))
            {
                return;
            }

            if (targ is BaseBeverage)
            {
                BaseBeverage bev = (BaseBeverage)targ;

                if (bev.IsEmpty || !bev.ValidateUse(from, true))
                {
                    return;
                }

                this.Content  = bev.Content;
                this.Poison   = bev.Poison;
                this.Poisoner = bev.Poisoner;

                if (bev.Quantity > this.MaxQuantity)
                {
                    this.Quantity = this.MaxQuantity;
                    bev.Quantity -= this.MaxQuantity;
                }
                else
                {
                    this.Quantity += bev.Quantity;
                    bev.Quantity   = 0;
                }
            }
            else if (targ is BaseWaterContainer)
            {
                BaseWaterContainer bwc = targ as BaseWaterContainer;

                if (Quantity == 0 || (Content == BeverageType.Water && !IsFull))
                {
                    int iNeed = Math.Min((MaxQuantity - Quantity), bwc.Quantity);

                    if (iNeed > 0 && !bwc.IsEmpty && !IsFull)
                    {
                        bwc.Quantity -= iNeed;
                        Quantity     += iNeed;
                        Content       = BeverageType.Water;

                        from.PlaySound(0x4E);
                    }
                }
            }
            else if (targ is Item)
            {
                Item         item = (Item)targ;
                IWaterSource src;

                src = (item as IWaterSource);

                if (src == null && item is AddonComponent)
                {
                    src = (((AddonComponent)item).Addon as IWaterSource);
                }

                if (src == null || src.Quantity <= 0)
                {
                    return;
                }

                if (from.Map != item.Map || !from.InRange(item.GetWorldLocation(), 2) || !from.InLOS(item))
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045);                       // I can't reach that.
                    return;
                }

                this.Content  = BeverageType.Water;
                this.Poison   = null;
                this.Poisoner = null;

                if (src.Quantity > this.MaxQuantity)
                {
                    this.Quantity = this.MaxQuantity;
                    src.Quantity -= this.MaxQuantity;
                }
                else
                {
                    this.Quantity += src.Quantity;
                    src.Quantity   = 0;
                }

                from.SendLocalizedMessage(1010089);                   // You fill the container with water.
            }
            else if (targ is Cow)
            {
                Cow cow = (Cow)targ;

                if (cow.TryMilk(from))
                {
                    Content  = BeverageType.Milk;
                    Quantity = MaxQuantity;
                    from.SendLocalizedMessage(1080197);                       // You fill the container with milk.
                }
            }
            else if (targ is LandTarget)
            {
                int tileID = ((LandTarget)targ).TileID;

                PlayerMobile player = from as PlayerMobile;

                if (player != null)
                {
                    QuestSystem qs = player.Quest;

                    if (qs is WitchApprenticeQuest)
                    {
                        FindIngredientObjective obj = qs.FindObjective(typeof(FindIngredientObjective)) as FindIngredientObjective;

                        if (obj != null && !obj.Completed && obj.Ingredient == Ingredient.SwampWater)
                        {
                            bool contains = false;

                            for (int i = 0; !contains && i < m_SwampTiles.Length; i += 2)
                            {
                                contains = (tileID >= m_SwampTiles[i] && tileID <= m_SwampTiles[i + 1]);
                            }

                            if (contains)
                            {
                                Delete();

                                player.SendLocalizedMessage(1055035);                                   // You dip the container into the disgusting swamp water, collecting enough for the Hag's vile stew.
                                obj.Complete();
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 27
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Item)
                {
                    Item item = (Item)targeted;

                    if (item is IDyable && m_Tub.AllowDyables)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446); // That is too far away.
                        }
                        else if (item.IsLockedDown)
                        {
                            from.SendLocalizedMessage(1061637); // You are not allowed to access this.
                        }
                        else if (item.Parent is Mobile)
                        {
                            from.SendLocalizedMessage(500861); // Can't Dye clothing that is being worn.
                        }
                        else if (((IDyable)item).Dye(from, m_Tub))
                        {
                            from.PlaySound(0x23E);
                        }
                    }
                    else if ((FurnitureAttribute.Check(item) || (item is PotionKeg)) && m_Tub.AllowFurniture)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446); // That is too far away.
                        }
                        else
                        {
                            bool okay = (item.IsChildOf(from.Backpack));

                            if (!okay)
                            {
                                if (item.Parent == null)
                                {
                                    BaseHouse house = BaseHouse.FindHouseAt(item);

                                    if (!house.IsCoOwner(from))
                                    {
                                        from.SendLocalizedMessage(501023); // You must be the owner to use this item.
                                    }
                                    else if (house == null || (!house.IsLockedDown(item) && !house.IsSecure(item)) && (!(item is AddonComponent) || !house.Addons.ContainsKey(((AddonComponent)item).Addon)))
                                    {
                                        from.SendLocalizedMessage(501022); // Furniture must be locked down to paint it.
                                    }
                                    else
                                    {
                                        okay = true;
                                    }
                                }
                                else
                                {
                                    from.SendLocalizedMessage(1048135); // The furniture must be in your backpack to be painted.
                                }
                            }

                            if (okay)
                            {
                                item.Hue = m_Tub.DyedHue;
                                from.PlaySound(0x23E);
                            }
                        }
                    }
                    else if ((item is Runebook || item is RecallRune) && m_Tub.AllowRunebooks)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446); // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1049776); // You cannot dye runes or runebooks that are locked down.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    else if ((item is MonsterStatuette || item is MongbatDartboard || item is FelineBlessedStatue) && m_Tub.AllowStatuettes)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446); // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1049779); // You cannot dye statuettes that are locked down.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    else if (m_Tub.AllowLeather)
                    {
                        if ((item is BaseArmor && (((BaseArmor)item).MaterialType == ArmorMaterialType.Leather || ((BaseArmor)item).MaterialType == ArmorMaterialType.Studded)) ||
                            (item is BaseClothing && (((BaseClothing)item).DefaultResource == CraftResource.RegularLeather) || item is WoodlandBelt || item is BarbedWhip ||
                             item is BladedWhip || item is SpikedWhip))
                        {
                            if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                            {
                                from.SendLocalizedMessage(500446); // That is too far away.
                            }
                            else if (!item.Movable)
                            {
                                from.SendLocalizedMessage(1042419); // You may not dye leather items which are locked down.
                            }
                            else if (item.Parent is Mobile)
                            {
                                from.SendLocalizedMessage(500861); // Can't Dye clothing that is being worn.
                            }
                            else
                            {
                                item.Hue = m_Tub.DyedHue;
                                from.PlaySound(0x23E);
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(m_Tub.FailMessage);
                        }
                    }
                    else if ((item is BaseArmor && (((BaseArmor)item).MaterialType == ArmorMaterialType.Chainmail || ((BaseArmor)item).MaterialType == ArmorMaterialType.Ringmail || ((BaseArmor)item).MaterialType == ArmorMaterialType.Plate)) && m_Tub.AllowMetal)
                    {
                        if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                        {
                            from.SendLocalizedMessage(500446); // That is too far away.
                        }
                        else if (!item.Movable)
                        {
                            from.SendLocalizedMessage(1042419); // You may not dye leather items which are locked down.
                        }
                        else if (item.Parent is Mobile)
                        {
                            from.SendLocalizedMessage(500861); // Can't Dye clothing that is being worn.
                        }
                        else
                        {
                            item.Hue = m_Tub.DyedHue;
                            from.PlaySound(0x23E);
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(m_Tub.FailMessage);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(m_Tub.FailMessage);
                }
            }
Ejemplo n.º 28
0
        public virtual void Fill_OnTarget(Mobile from, object targ)
        {
            if (!IsEmpty || !Fillable || !ValidateUse(from, false))
            {
                return;
            }

            if (targ is BaseBeverage)
            {
                BaseBeverage bev = (BaseBeverage)targ;

                if (bev.IsEmpty || !bev.ValidateUse(from, true))
                {
                    return;
                }

                this.Content  = bev.Content;
                this.Poison   = bev.Poison;
                this.Poisoner = bev.Poisoner;

                //STARMOD: Teiravon beverage edit
                from.Emote("*pours some {1} into a {0}*", ((this.GetType()).Name).ToLower(), ((bev.Content).ToString()).ToLower());
                //ENDMOD: Teiravon beverage edit

                if (bev.Quantity > this.MaxQuantity)
                {
                    this.Quantity = this.MaxQuantity;
                    bev.Quantity -= this.MaxQuantity;
                }
                else
                {
                    this.Quantity += bev.Quantity;
                    bev.Quantity   = 0;
                }
            }
            else if (targ is Item)
            {
                Item         item = (Item)targ;
                IWaterSource src;

                src = (item as IWaterSource);

                if (src == null && item is AddonComponent)
                {
                    src = (((AddonComponent)item).Addon as IWaterSource);
                }

                if (src == null || src.Quantity <= 0)
                {
                    return;
                }

                if (from.Map != item.Map || !from.InRange(item.GetWorldLocation(), 2) || !from.InLOS(item))
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045);                       // I can't reach that.
                    return;
                }

                this.Content  = BeverageType.Water;
                this.Poison   = null;
                this.Poisoner = null;

                if (src.Quantity > this.MaxQuantity)
                {
                    this.Quantity = this.MaxQuantity;
                    src.Quantity -= this.MaxQuantity;
                }
                else
                {
                    this.Quantity += src.Quantity;
                    src.Quantity   = 0;
                }

                //STARTMOD: Beverage edit
                from.Emote("*fills a {0} with water*", ((this.GetType()).Name).ToLower());
                //ENDMOD: Beverage edit
                from.SendLocalizedMessage(1010089);                   // You fill the container with water.
            }
            else if (targ is LandTarget)
            {
                int tileID = ((LandTarget)targ).TileID;

                PlayerMobile player = from as PlayerMobile;

                if (player != null)
                {
                    QuestSystem qs = player.Quest;

                    if (qs is WitchApprenticeQuest)
                    {
                        FindIngredientObjective obj = qs.FindObjective(typeof(FindIngredientObjective)) as FindIngredientObjective;

                        if (obj != null && !obj.Completed && obj.Ingredient == Ingredient.SwampWater)
                        {
                            bool contains = false;

                            for (int i = 0; !contains && i < m_SwampTiles.Length; i += 2)
                            {
                                contains = (tileID >= m_SwampTiles[i] && tileID <= m_SwampTiles[i + 1]);
                            }

                            if (contains)
                            {
                                Delete();

                                player.SendLocalizedMessage(1055035);                                   // You dip the container into the disgusting swamp water, collecting enough for the Hag's vile stew.
                                obj.Complete();
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 29
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (this.m_Item.Deleted)
                {
                    return;
                }

                Item item  = targeted as Item;
                bool valid = false;

                if (item != null)
                {
                    if (m_Item.BooksOnly && !(item is Spellbook))
                    {
                        valid = false;
                    }
                    else
                    {
                        valid = (item is IDyable ||
                                 item is BaseBook || item is BaseClothing ||
                                 item is BaseJewel || item is BaseStatuette ||
                                 item is BaseWeapon || item is Runebook ||
                                 item is BaseTalisman || item is Spellbook ||
                                 item.IsArtifact || BasePigmentsOfTokuno.IsValidItem(item));

                        if (!valid && item is BaseArmor)
                        {
                            CraftResourceType restype = CraftResources.GetType(((BaseArmor)item).Resource);
                            if ((CraftResourceType.Leather == restype || CraftResourceType.Metal == restype) &&
                                ArmorMaterialType.Bone != ((BaseArmor)item).MaterialType)
                            {
                                valid = true;
                            }
                        }

                        if (!valid && FurnitureAttribute.Check(item))
                        {
                            if (!from.InRange(this.m_Item.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
                            {
                                from.SendLocalizedMessage(500446); // That is too far away.
                                return;
                            }
                            else
                            {
                                BaseHouse house = BaseHouse.FindHouseAt(item);

                                if (house == null || (!house.IsLockedDown(item) && !house.IsSecure(item)))
                                {
                                    from.SendLocalizedMessage(501022); // Furniture must be locked down to paint it.
                                    return;
                                }
                                else if (!house.IsCoOwner(from))
                                {
                                    from.SendLocalizedMessage(501023); // You must be the owner to use this item.
                                    return;
                                }
                                else
                                {
                                    valid = true;
                                }
                            }
                        }
                    }

                    if (valid)
                    {
                        item.Hue = m_Item.Hue;
                        from.PlaySound(0x23E);

                        if (--this.m_Item.UsesRemaining > 0)
                        {
                            this.m_Item.InvalidateProperties();
                        }
                        else
                        {
                            this.m_Item.Delete();
                        }

                        return;
                    }
                }

                from.SendLocalizedMessage(1042083); // You cannot dye that.
            }
Ejemplo n.º 30
0
                protected override void OnTick()
                {
                    Item item = (Item)m_Item;

                    if (!m_From.InRange(item.GetWorldLocation(), 1))
                    {
                        return;
                    }

                    bool canPsy = m_From.Competences[CompType.Psychologie].roll(10);

                    foreach (NubiaMobile m in m_From.GetMobilesInRange(6))
                    {
                        if (m is NubiaPlayer && m != m_From)
                        {
                            if (m.Competences[CompType.PerceptionAuditive].intRoll(false) >= m_From.Competences[CompType.Discretion].intRoll())
                            {
                                if (canPsy)
                                {
                                    m_From.SendMessage("{0} semble vous avoir repérez, vous manquez de discretion !", m.Name);
                                }
                                m_From.PrivateOverheadMessage(Server.Network.MessageType.Emote, 0, false, "*crochète une serrure*", m.NetState);
                            }
                        }
                    }

                    if (m_From.Competences[CompType.Crochetage].getPureMaitrise() < m_Item.MiniMaitrise ||
                        m_From.Competences[CompType.Crochetage].getPureMaitrise() + 20 < (int)m_Item.Serrure)
                    {
                        /*
                         * // Do some training to gain skills
                         * m_From.CheckSkill( SkillName.Lockpicking, 0, m_Item.LockLevel );*/

                        // The LockLevel is higher thant the LockPicking of the player
                        m_From.SendMessage("Réussite impossible");
                        item.SendLocalizedMessageTo(m_From, 502072); // You don't see how that lock can be manipulated.
                        return;
                    }

                    int malus = 0;

                    if (m_Lockpick == null)
                    {
                        malus = -4;
                        m_From.SendMessage("Vous n'avez pas d'outils, malus de circonstance de " + malus.ToString());
                    }

                    if (m_From.Competences[CompType.Crochetage].roll((int)m_Item.Serrure + malus))
                    {
                        // Success! Pick the lock!
                        item.SendLocalizedMessageTo(m_From, 502076); // The lock quickly yields to your skill.
                        m_From.PlaySound(0x4A);
                        m_Item.LockPick(m_From);
                    }
                    else
                    {
                        // The player failed to pick the lock
                        item.SendLocalizedMessageTo(m_From, 502075); // You are unable to pick the lock.
                    }

                    //Consomation du lockPick
                    if (m_Lockpick != null && !m_From.Competences[CompType.Crochetage].roll((int)m_Item.Serrure))
                    {
                        BrokeLockPickTest();
                    }
                }
Ejemplo n.º 31
0
        private void Detonate_OnTick(object state)
        {
            if (Deleted)
            {
                return;
            }

            object[] states = (object[])state;
            Mobile   from   = (Mobile)states[0];
            int      timer  = (int)states[1];

            object parent = FindParent(from);

            if (timer == 0)
            {
                Point3D loc;
                Map     map;
                Mobile  m = from;

                if (parent is Item)
                {
                    Item item = (Item)parent;

                    loc = item.GetWorldLocation();
                    map = item.Map;
                }
                else if (parent is Mobile)
                {
                    if (m_Users != null && m_Users[m_Users.Count - 1] is Mobile)
                    {
                        m = (Mobile)m_Users[m_Users.Count - 1];
                    }
                    else
                    {
                        m = (Mobile)parent;
                    }

                    loc = m.Location;
                    map = m.Map;
                }
                else
                {
                    return;
                }

                Explode(m, true, loc, map);
                m_Timer = null;
            }
            else
            {
                if (parent is Item)
                {
                    ((Item)parent).PublicOverheadMessage(MessageType.Regular, 906, true, timer.ToString());
                }
                else if (parent is Mobile)
                {
                    ((Mobile)parent).PublicOverheadMessage(MessageType.Regular, 906, true, timer.ToString());
                }

                states[1] = timer - 1;
            }
        }