Esempio n. 1
0
            protected override void OnTarget( Mobile from, object targeted )
            {
                if( targeted is Mobile )
                {
                    from.SendLocalizedMessage(502816); // You feel that such an action would be inappropriate
                }
                else if( targeted is TrapableContainer )
                {
                    TrapableContainer targ = (TrapableContainer)targeted;

                    from.Direction = from.GetDirectionTo(targ);

                    if( targ.TrapType == TrapType.None )
                    {
                        from.SendLocalizedMessage(502373); // That doesn't appear to be trapped
                        return;
                    }

                    from.PlaySound(0x241);

                    if( from.CheckTargetSkill(SkillName.RemoveTrap, targ, targ.TrapPower, targ.TrapPower + 30) )
                    {
                        targ.TrapPower = 0;
                        targ.TrapLevel = 0;
                        targ.TrapType = TrapType.None;
                        from.SendLocalizedMessage(502377); // You successfully render the trap harmless
                    }
                    else
                    {
                        from.SendLocalizedMessage(502372); // You fail to disarm the trap... but you don't set it off
                    }
                }
                else if( targeted is BaseDoor && ((BaseDoor)targeted).TrapAvailable )
                {
                    if( from.CheckTargetSkill(SkillName.RemoveTrap, targeted, (targeted is BaseHouseDoor ? 95.0 : 75.0), (targeted is BaseHouseDoor ? 120.0 : 100.0)) )
                    {
                        from.SendLocalizedMessage(502377); //You successfully render the trap harmless.
                        ((BaseDoor)targeted).RemoveTrap();
                    }
                    else
                    {
                        if( 0.20 >= Utility.RandomDouble() )
                        {
                            from.SendMessage("You fail to disarm the trap, and accidentally set it off!");
                            ((BaseDoor)targeted).DoorTrap.Trigger(from);
                        }
                        else
                            from.SendLocalizedMessage(502372);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502373); // That does'nt appear to be trapped
                }

                EventSink.InvokeSkillUsed(new SkillUsedEventArgs(from, from.Skills[SkillName.RemoveTrap]));
            }
Esempio n. 2
0
			protected override void OnTarget( Mobile from, object targeted )
			{
                IEntity entity = targeted as IEntity; if (XmlScript.HasTrigger(entity, TriggerName.onTargeted) && UberScriptTriggers.Trigger(entity, from, TriggerName.onTargeted, null, null, null, 0, null, SkillName.TasteID, from.Skills[SkillName.TasteID].Value))
                {
                    return;
                }
                
                if ( targeted is Mobile )
				{
					from.SendLocalizedMessage( 502816 ); // You feel that such an action would be inappropriate.
				}
				else if ( targeted is Food )
				{
					Food food = (Food) targeted;

					if ( from.CheckTargetSkill( SkillName.TasteID, food, 0, 100 ) )
					{
						if ( food.Poison != null )
						{
							food.SendLocalizedMessageTo( from, 1038284 ); // It appears to have poison smeared on it.
						}
						else
						{
							// No poison on the food
							food.SendLocalizedMessageTo( from, 1010600 ); // You detect nothing unusual about this substance.
						}
					}
					else
					{
						// Skill check failed
						food.SendLocalizedMessageTo( from, 502823 ); // You cannot discern anything about this substance.
					}
				}
				else if ( targeted is BasePotion )
				{
					BasePotion potion = (BasePotion) targeted;

					potion.SendLocalizedMessageTo( from, 502813 ); // You already know what kind of potion that is.
					potion.SendLocalizedMessageTo( from, potion.LabelNumber );
				}
				else if ( targeted is PotionKeg )
				{
					PotionKeg keg = (PotionKeg) targeted;

					if ( keg.Held <= 0 )
					{
						keg.SendLocalizedMessageTo( from, 502228 ); // There is nothing in the keg to taste!
					}
					else
					{
						keg.SendLocalizedMessageTo( from, 502229 ); // You are already familiar with this keg's contents.
						keg.SendLocalizedMessageTo( from, keg.LabelNumber );
					}
				}
				else
				{
					// The target is not food or potion or potion keg.
					from.SendLocalizedMessage( 502820 ); // That's not something you can taste.
				}
			}
Esempio n. 3
0
        public void ChangelingDropTarget(Mobile from, object obj)
        {
            if (!(obj is HairStrand))
            {
                from.SendMessage("Cela ne servirait à rien de verser le liquide ici");
                return;
            }

            HairStrand targ = (HairStrand)obj;

            if (from.Skills[SkillName.Alchemy].Value < 60)
            {
                from.SendMessage("Vos maigres talents d'alchimistes ne permettraient pas une pareille mixture...");
                return;
            }

            if (!from.CheckTargetSkill(SkillName.Alchemy, targ, 55, 95))
            {
                from.SendMessage("Vous mettez trop de cheveux à l'intérieur, ce qui gâche le mélange...");
                targ.Delete();
                return;
            }

            from.PrivateOverheadMessage(MessageType.Regular, 0x3B2, false, "Vous mélangez doucement le tout et terminez le mélange...", from.NetState);
            GenderPotion potion = new GenderPotion();
            potion.Female = targ.HairOwner.Female;
            from.AddToBackpack(potion);
            this.Delete();
            targ.Delete();
            return;
        }
Esempio n. 4
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (from == targeted)
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500324); // You know yourself quite well enough already.
                }
                else if (targeted is TownCrier)
                {
                    ((TownCrier)targeted).PrivateOverheadMessage(MessageType.Regular, 0x3B2, 500322, from.NetState); // This person looks fine to me, though he may have some news...
                }
                else if (targeted is BaseVendor && ((BaseVendor)targeted).IsInvulnerable)
                {
                    ((BaseVendor)targeted).PrivateOverheadMessage(MessageType.Regular, 0x3B2, 500326, from.NetState); // That can not be inspected.
                }
                else if (targeted is Mobile)
                {
                    Mobile targ = (Mobile)targeted;

                    int marginOfError = Math.Max(0, 25 - (int)(from.Skills[SkillName.Anatomy].Value / 4));

                    int str = targ.Str + Utility.RandomMinMax(-marginOfError, +marginOfError);
                    int dex = targ.Dex + Utility.RandomMinMax(-marginOfError, +marginOfError);
                    int stm = ((targ.Stam * 100) / Math.Max(targ.StamMax, 1)) + Utility.RandomMinMax(-marginOfError, +marginOfError);

                    int strMod = str / 10;
                    int dexMod = dex / 10;
                    int stmMod = stm / 10;

                    if (strMod < 0)
                        strMod = 0;
                    else if (strMod > 10)
                        strMod = 10;

                    if (dexMod < 0)
                        dexMod = 0;
                    else if (dexMod > 10)
                        dexMod = 10;

                    if (stmMod > 10)
                        stmMod = 10;
                    else if (stmMod < 0)
                        stmMod = 0;

                    if (from.CheckTargetSkill(SkillName.Anatomy, targ, 0, 100))
                    {
                        targ.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1038045 + (strMod * 11) + dexMod, from.NetState); // That looks [strong] and [dexterous].

                        if (from.Skills[SkillName.Anatomy].Base >= 65.0)
                            targ.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1038303 + stmMod, from.NetState); // That being is at [10,20,...] percent endurance.
                    }
                    else
                    {
                        targ.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1042666, from.NetState); // You can not quite get a sense of their physical characteristics.
                    }
                }
                else if (targeted is Item)
                {
                    ((Item)targeted).SendLocalizedMessageTo(from, 500323, ""); // Only living things have anatomies!
                }
            }
Esempio n. 5
0
			protected override void OnTarget( Mobile from, object targeted )
			{
				if ( targeted is Mobile )
				{
					from.SendLocalizedMessage( 502816 ); // You feel that such an action would be inappropriate
				}
				else if ( targeted is Food )
				{
					if ( from.CheckTargetSkill( SkillName.TasteID, targeted, 0, 100 ) )
					{
						Food targ = (Food)targeted;

						if ( targ.Poison != null )
						{
							from.SendLocalizedMessage( 1038284 ); // It appears to have poison smeared on it
						}
						else
						{
							// No poison on the food
							from.SendLocalizedMessage( 502823 ); // You cannot discern anything about this substance
						}
					}
					else
					{
						// Skill check failed
						from.SendLocalizedMessage( 502823 ); // You cannot discern anything about this substance
					}
				}
				else
				{
					// The target is not food. (Potion support in the next version)
					from.SendLocalizedMessage( 502820 ); // That's not something you can taste
				}
			}
Esempio n. 6
0
			private static void Check(Mobile from, BaseCreature c, double min)
			{
				if (from.CheckTargetSkill(SkillName.AnimalLore, c, min, 120.0))
					SendGump(from, c);
				else
					from.SendLocalizedMessage(500334); // You can't think of anything you know offhand.
			}
Esempio n. 7
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (from == targeted)
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500910); // Hmm, that person looks really silly.
                }
                else if (targeted is TownCrier)
                {
                    ((TownCrier)targeted).PrivateOverheadMessage(MessageType.Regular, 0x3B2, 500907, from.NetState); // He looks smart enough to remember the news.  Ask him about it.
                }
                else if (targeted is BaseVendor && ((BaseVendor)targeted).IsInvulnerable)
                {
                    ((BaseVendor)targeted).PrivateOverheadMessage(MessageType.Regular, 0x3B2, 500909, from.NetState); // That person could probably calculate the cost of what you buy from them.
                }
                else if (targeted is Mobile)
                {
                    Mobile targ = (Mobile)targeted;

                    int marginOfError = Math.Max(0, 20 - (int)(from.Skills[SkillName.EvalInt].Value / 5));

                    int intel = targ.Int + Utility.RandomMinMax(-marginOfError, +marginOfError);
                    int mana = ((targ.Mana * 100) / Math.Max(targ.ManaMax, 1)) + Utility.RandomMinMax(-marginOfError, +marginOfError);

                    int intMod = intel / 10;
                    int mnMod = mana / 10;

                    if (intMod > 10)
                        intMod = 10;
                    else if (intMod < 0)
                        intMod = 0;

                    if (mnMod > 10)
                        mnMod = 10;
                    else if (mnMod < 0)
                        mnMod = 0;

                    int body;

                    if (targ.Body.IsHuman)
                        body = targ.Female ? 11 : 0;
                    else
                        body = 22;

                    if (from.CheckTargetSkill(SkillName.EvalInt, targ, 0.0, 120.0))
                    {
                        targ.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1038169 + intMod + body, from.NetState); // He/She/It looks [slighly less intelligent than a rock.]  [Of Average intellect] [etc...]

                        if (from.Skills[SkillName.EvalInt].Base >= 76.0)
                            targ.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1038202 + mnMod, from.NetState); // That being is at [10,20,...] percent mental strength.
                    }
                    else 
                    {
                        targ.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1038166 + (body / 11), from.NetState); // You cannot judge his/her/its mental abilities.
                    }
                }
                else if (targeted is Item)
                {
                    ((Item)targeted).SendLocalizedMessageTo(from, 500908, ""); // It looks smarter than a rock, but dumber than a piece of wood.
                }
            }
Esempio n. 8
0
            protected override void OnTarget(Mobile from, object o)
            {
                if (o is Item)
                {
                    if (from.CheckTargetSkill(SkillName.ItemID, o, 0, 100))
                    {
                        if (o is BaseWeapon)
                            ((BaseWeapon)o).Identified = true;
                        else if (o is BaseArmor)
                            ((BaseArmor)o).Identified = true;

                        if (!Core.AOS)
                            ((Item)o).OnSingleClick(from);
                    }
                    else
                    {
                        from.SendLocalizedMessage(500353); // You are not certain...
                    }
                }
                else if (o is Mobile)
                {
                    ((Mobile)o).OnSingleClick(from);
                }
                else
                {
                    from.SendLocalizedMessage(500353); // You are not certain...
                }
                Server.Engines.XmlSpawner2.XmlAttach.RevealAttachments(from, o);
            }
Esempio n. 9
0
			protected override void OnTarget( Mobile from, object o )
			{
				if ( o is Item )
				{
					if ( from.CheckTargetSkill( SkillName.ItemID, o, 0, 100 ) )
					{
						if ( o is BaseWeapon )
							((BaseWeapon)o).Identified = true;
						else if ( o is BaseArmor )
							((BaseArmor)o).Identified = true;

						((Item)o).OnSingleClick( from );
					}
					else
					{
						from.SendLocalizedMessage( 500353 ); // You are not certain...
					}
				}
				else if ( o is Mobile )
				{
					((Mobile)o).OnSingleClick( from );
				}
				else
				{
					from.SendLocalizedMessage( 500353 ); // You are not certain...
				}
			}
Esempio n. 10
0
            protected override void OnTarget( Mobile from, object targeted )
            {
                if ( targeted is Mobile )
                {
                    from.SendLocalizedMessage( 502816 ); // You feel that such an action would be inappropriate
                }
                else if ( targeted is TrapableContainer )
                {
                    TrapableContainer targ = (TrapableContainer)targeted;

                    from.Direction = from.GetDirectionTo( targ );

                    if ( !targ.Trapped )
                    {
                        from.SendLocalizedMessage( 502373 ); // That doesn't appear to be trapped
                        return;
                    }

                    from.PlaySound( 0x241 );

                    if ( from.CheckTargetSkill( SkillName.RemoveTrap, targ, targ.TrapPower, targ.TrapPower + 30 ) )
                    {
                        targ.Trapped = false;
                        from.SendLocalizedMessage( 502377 ); // You successfully render the trap harmless
                    }
                    else
                    {
                        from.SendLocalizedMessage( 502372 ); // You fail to disarm the trap... but you don't set it off
                    }
                }
                else
                {
                    from.SendLocalizedMessage( 502373 ); // That does'nt appear to be trapped
                }
            }
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (!from.Alive)
                {
                    from.SendLocalizedMessage(500331); // The spirits of the dead are not the province of animal lore.
                }
                else if (targeted is BaseCreature)
                {
                    BaseCreature c = (BaseCreature)targeted;

                    if (!c.IsDeadPet)
                    {
                        if (c.Body.IsAnimal || c.Body.IsMonster || c.Body.IsSea)
                        {
                            if (!c.Controlled && from.Skills[SkillName.AnimalLore].Value < 100.0)
                            {
                                from.SendLocalizedMessage(1049674); // At your skill level, you can only lore tamed creatures.
                            }
                            else if (!c.Controlled && !c.Tamable && from.Skills[SkillName.AnimalLore].Value < 110.0)
                            {
                                from.SendLocalizedMessage(1049675); // At your skill level, you can only lore tamed or tameable creatures.
                            }
                            else if (!from.CheckTargetSkill(SkillName.AnimalLore, c, 0.0, 120.0))
                            {
                                from.SendLocalizedMessage(500334); // You can't think of anything you know offhand.
                            }
                            else if ((c is LadyMelisande || c is DreadHorn || c is Travesty || c is MonstrousInterredGrizzle || c is ChiefParoxysmus || c is ShimmeringEffusion) && 0.01 < Utility.RandomDouble())
                            {
                                from.SendLocalizedMessage(500334); // You can't think of anything you know offhand.
                            }
                            else
                            {
                                from.CloseGump(typeof(AnimalLoreGump));
                                from.SendGump(new AnimalLoreGump(c));
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(500329); // That's not an animal!
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(500331); // The spirits of the dead are not the province of animal lore.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500329); // That's not an animal!
                }
            }
Esempio n. 12
0
            protected override void OnTarget( Mobile from, object targeted )
            {
                if( !from.Alive )
                {
                    from.SendLocalizedMessage(500331); // The spirits of the dead are not the province of animal lore.
                }
                else if( targeted is BaseCreature )
                {
                    BaseCreature c = (BaseCreature)targeted;

                    if( !c.IsDeadPet )
                    {
                        if( c.Body.IsAnimal || c.Body.IsMonster || c.Body.IsSea )
                        {
                            if( (!c.Controlled || !c.Tamable) && from.Skills[SkillName.AnimalLore].Base < 85.0 )
                            {
                                from.SendLocalizedMessage(1049674); // At your skill level, you can only lore tamed creatures.
                            }
                            else if( !c.Tamable && from.Skills[SkillName.AnimalLore].Base < 90.0 )
                            {
                                from.SendLocalizedMessage(1049675); // At your skill level, you can only lore tamed or tameable creatures.
                            }
                            else if( !from.CheckTargetSkill(SkillName.AnimalLore, c, 0.0, 100.0) )
                            {
                                from.SendLocalizedMessage(500334); // You can't think of anything you know offhand.
                            }
                            else
                            {
                                from.CloseGump(typeof(AnimalLoreGump));
                                from.SendGump(new AnimalLoreGump(c));
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(500329); // That's not an animal!
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(500331); // The spirits of the dead are not the province of animal lore.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500329); // That's not an animal!
                }

                EventSink.InvokeSkillUsed(new SkillUsedEventArgs(from, from.Skills[SkillName.AnimalLore]));
            }
Esempio n. 13
0
        public void OnTarget(Mobile from, object obj)
        {
            if (!(obj is AlchemyVial))
            {
                from.SendMessage("Cela ne servira à rien");
                return;
            }

            AlchemyVial targ = (AlchemyVial)obj;

            if (targ.AlchemyLiquidType != LiquidType.OgreBlood && targ.AlchemyLiquidType != LiquidType.OrcBlood && targ.AlchemyLiquidType != LiquidType.TrollBlood)
            {
                from.SendMessage("Vous versez le sang, mais rien ne se passe");
                targ.AlchemyLiquidType = LiquidType.None;
                return;
            }

            if (!from.CheckTargetSkill(SkillName.Alchemy, targ, 50, 95))
            {
                from.SendMessage("Vous versez le sang, mais échouez à faire tomber les gravats");
                targ.AlchemyLiquidType = LiquidType.None;
                return;
            }

            int rarete = 0;

            switch (Resource)
            {
                case CraftResource.BlackScales: rarete = 2; break;
                case CraftResource.WhiteScales: rarete = 3; break;
                case CraftResource.GreenScales: rarete = 4; break;
                case CraftResource.BlueScales: rarete = 4; break;
                default: rarete = 6; break;
            }
            if (this.Amount >= rarete)
            {
                from.SendMessage("Vous recueillez des gravats");
                this.m_Harvested = true;
                DragonOre ore = new DragonOre();
                ore.ItemID = 0x19B8;
                ore.Amount = (int)Math.Floor(this.Amount / (double)rarete);
                from.AddToBackpack(ore);
                targ.AlchemyLiquidType = LiquidType.None;
            }
            else
                from.SendMessage("Il n'y en a malheureusement pas assez pour constituer des gravats convenables");
        }
Esempio n. 14
0
 /*** ADDED ***/
 // ALAMBIK
 // Modification implementation of mounted chivalry
 public override void OnHit(Mobile attacker, Mobile defender, double damageBonus)
 {
     Skill skill = attacker.Skills[SkillName.Chivalry];
     if (attacker.Mounted    // attaquant sur un cheval
        && !(defender.Mounted)   // défenseur pas sur un cheval
        && ((attacker.Direction & Direction.Running) != 0)   // cours
        && (skill != null && (Utility.Random(120) <= ((int)(skill.Value) + 10)))
        && attacker.CheckTargetSkill(SkillName.Chivalry, defender, 0.0, 120.0)
        )
     {
         attacker.SendMessage("Votre attaque montée disloque votre adversaire!");
         defender.PlaySound(1308);
         base.OnHit(attacker, defender, 1.20);   // bonus 1/5 au lieu de 1/4
     }
     else
     {
         base.OnHit(attacker, defender, 1.0);
     }
 }
Esempio n. 15
0
 protected override void OnTarget( Mobile from, object targeted )
 {
     if ( targeted is BaseWeapon || targeted is BaseArmor )
     {
         if ( from.CheckTargetSkill( SkillName.ArmsLore, targeted, 0, 100 ) )
         {
             // You study the item in an attempt to learn more of its craftsmanship and use.
             from.SendLocalizedMessage( 1061657 );
         }
         else
         {
             // You are not certain...
             from.SendLocalizedMessage( 500353 );
         }
     }
     else
     {
         // This is neither weapon nor armor.
         from.SendLocalizedMessage( 500352 );
     }
 }
Esempio n. 16
0
 protected override void OnTarget( Mobile from, object targeted )
 {
     if ( targeted is Food )
     {
         if ( from.CheckTargetSkill( SkillName.TasteID, targeted, 0, 100 ) )
         {
             if ( ((Food)targeted).Poison != null )
                 from.SendLocalizedMessage( 1038284 ); // It appears to have poison smeared on it
             else
                 from.SendAsciiMessage( "You notice nothing unusual." );
         }
         else
         {
             from.SendLocalizedMessage( 502823 ); // You cannot discern anything about this substance
         }
     }
     else
     {
         // TODO: Potion support ?
         from.SendLocalizedMessage( 502820 ); // That's not something you can taste
     }
 }
Esempio n. 17
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Log.Deleted)
                {
                    return;
                }

                if (!from.InRange(m_Log.GetWorldLocation(), 2))
                {
                    from.SendMessage("The logs are too far away.");
                    return;
                }

                if (IsMill(targeted))
                {
                    double difficulty;

                    switch (m_Log.Resource)
                    {
                    default: difficulty = 40.0; break;

                    case CraftResource.AshTree: difficulty = 55.0; break;

                    case CraftResource.CherryTree: difficulty = 60.0; break;

                    case CraftResource.EbonyTree: difficulty = 65.0; break;

                    case CraftResource.GoldenOakTree: difficulty = 70.0; break;

                    case CraftResource.HickoryTree: difficulty = 75.0; break;

                    case CraftResource.MahoganyTree: difficulty = 80.0; break;

                    case CraftResource.DriftwoodTree: difficulty = 80.0; break;

                    case CraftResource.OakTree: difficulty = 85.0; break;

                    case CraftResource.PineTree: difficulty = 90.0; break;

                    case CraftResource.GhostTree: difficulty = 90.0; break;

                    case CraftResource.RosewoodTree: difficulty = 95.0; break;

                    case CraftResource.WalnutTree: difficulty = 99.0; break;

                    case CraftResource.PetrifiedTree: difficulty = 99.9; break;

                    case CraftResource.ElvenTree: difficulty = 100.1; break;
                    }

                    double minSkill = difficulty - 25.0;
                    double maxSkill = difficulty + 25.0;

                    if (difficulty > 50.0 && difficulty > from.Skills[SkillName.Lumberjacking].Value)
                    {
                        from.SendMessage("You have no idea how to best cut this type of wood!");
                        return;
                    }

                    if (from.CheckTargetSkill(SkillName.Lumberjacking, targeted, minSkill, maxSkill))
                    {
                        if (m_Log.Amount <= 0)
                        {
                            from.SendMessage("There is not enough wood in this pile to make a board.");
                        }
                        else
                        {
                            int           amount = m_Log.Amount;
                            BaseWoodBoard wood   = m_Log.GetLog();
                            m_Log.Delete();
                            wood.Amount = amount;
                            from.AddToBackpack(wood);
                            from.PlaySound(0x21C);
                            from.SendMessage("You cut the logs and put some boards in your backpack.");
                        }
                    }
                    else
                    {
                        int amount = m_Log.Amount;
                        int lose   = Utility.RandomMinMax(1, amount);

                        if (amount < 2 || lose == amount)
                        {
                            m_Log.Delete();
                            from.SendMessage("You try to cut the logs but ruin all of the wood.");
                        }
                        else
                        {
                            m_Log.Amount = amount - lose;
                            from.SendMessage("You try to cut the logs but ruin some of the wood.");
                        }

                        from.PlaySound(0x21C);
                    }
                }
                else
                {
                    from.SendMessage("That is not a saw mill.");
                }
            }
Esempio n. 18
0
        public void OnComplete(Mobile m)
        {
            m.SendLocalizedMessage(1159009); // You successfully disarm the trap!

            m.CheckTargetSkill(SkillName.RemoveTrap, this, 0, 100);
        }
            protected override void OnTarget(Mobile from, object target)
            {
                if (target is Mobile)
                {
                    if (from.CheckTargetSkill(SkillName.Forensics, target, 40.0, 100.0))
                    {
                        if (target is PlayerMobile && ((PlayerMobile)target).NpcGuild == NpcGuild.ThievesGuild)
                        {
                            from.SendLocalizedMessage(501004);                              //That individual is a thief!
                        }
                        else
                        {
                            from.SendLocalizedMessage(501003);                              //You notice nothing unusual.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(501001);                          //You cannot determain anything useful.
                    }
                }
                else if (target is Corpse)
                {
                    if (from.CheckTargetSkill(SkillName.Forensics, target, 0.0, 100.0))
                    {
                        Corpse c = (Corpse)target;

                        if (((Body)c.Amount).IsHuman)
                        {
                            c.LabelTo(from, 1042751, (c.Killer == null ? "no one" : c.Killer.Name));                                //This person was killed by ~1_KILLER_NAME~
                        }
                        if (c.Looters.Count > 0)
                        {
                            StringBuilder sb = new StringBuilder();
                            for (int i = 0; i < c.Looters.Count; i++)
                            {
                                if (i > 0)
                                {
                                    sb.Append(", ");
                                }
                                sb.Append(((Mobile)c.Looters[i]).Name);
                            }

                            c.LabelTo(from, 1042752, sb.ToString());                              //This body has been distrubed by ~1_PLAYER_NAMES~
                        }
                        else
                        {
                            c.LabelTo(from, 501002);                              //The corpse has not be desecrated.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(501001);                          //You cannot determain anything useful.
                    }
                }
                else if (target is ILockpickable)
                {
                    ILockpickable p = (ILockpickable)target;
                    if (p.Picker != null)
                    {
                        from.SendLocalizedMessage(1042749, p.Picker.Name);                          //This lock was opened by ~1_PICKER_NAME~
                    }
                    else
                    {
                        from.SendLocalizedMessage(501003);                          //You notice nothing unusual.
                    }
                }
            }
Esempio n. 20
0
        public static void Container_Snoop(Container cont, Mobile from)
        {
            if (from.AccessLevel > AccessLevel.Player || from.InRange(cont.GetWorldLocation(), 1))
            {
                Mobile root = cont.RootParent as Mobile;

                if (root != null)
                {
                    if (root.Alive)
                    {
                        if (root.AccessLevel > AccessLevel.Player && from.AccessLevel == AccessLevel.Player)
                        {
                            from.SendLocalizedMessage(500209);                               // You can not peek into the container.
                            return;
                        }
                        else if (from.AccessLevel == AccessLevel.Player && !CheckSnoopAllowed(from, root))
                        {
                            from.SendLocalizedMessage(1001018);                               // You cannot perform negative acts on your target.
                            return;
                        }
                        else if (from.AccessLevel == AccessLevel.Player && from.Skills[SkillName.Snooping].Value < Utility.Random(100))
                        {
                            Map map = from.Map;

                            if (map != null)
                            {
                                root.SendMessage(String.Format("You notice {0} attempting to peek into your belongings.", from.Name));

                                string message = String.Format("You notice {0} attempting to peek into {1}'s belongings.", from.Name, root.Name);

                                IPooledEnumerable eable = map.GetClientsInRange(from.Location, 8);

                                foreach (NetState ns in eable)
                                {
                                    if (ns.Mobile != from && ns.Mobile != root)
                                    {
                                        ns.Mobile.SendMessage(message);
                                    }
                                }

                                eable.Free();
                            }
                        }
                    }
                    else
                    {
                        return;
                    }
                }

                if (from.AccessLevel == AccessLevel.Player)
                {
                    Titles.AwardKarma(from, -4, true);
                }

                if (from.AccessLevel > AccessLevel.Player || from.CheckTargetSkill(SkillName.Snooping, cont, 0.0, 100.0))
                {
                    if (!(cont is TrapableContainer && ((TrapableContainer)cont).ExecuteTrap(from)))
                    {
                        cont.DisplayTo(from);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500210);                       // You failed to peek into the container.
                    if (from.Skills[SkillName.Hiding].Value / 2 < Utility.Random(100))
                    {
                        from.RevealingAction();
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(500446);                   // That is too far away.
            }
        }
Esempio n. 21
0
            protected override void OnTarget(Mobile from, object target)
            {
                from.RevealingAction();
                from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(1.0);

                if (!m_Instrument.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1062488);                       // The instrument you are trying to play is no longer in your backpack!
                }
                else if (target is Mobile)
                {
                    Mobile targ = (Mobile)target;

                    if (targ == from || (targ is BaseCreature && (((BaseCreature)targ).BardImmune || !from.CanBeHarmful(targ, false)) && ((BaseCreature)targ).ControlMaster != from))
                    {
                        from.SendLocalizedMessage(1049535);                  // A song of discord would have no effect on that.
                    }
                    else if (m_Table.Contains(targ))                         //Already discorded
                    {
                        from.SendLocalizedMessage(1049537);                  // Your target is already in discord.
                    }
                    else if (!targ.Player)
                    {
                        double diff  = m_Instrument.GetDifficultyFor(targ) - 10.0;
                        double music = from.Skills[SkillName.Musicianship].Value;

                        if (music > 100.0)
                        {
                            diff -= (music - 100.0) * 0.5;
                        }

                        if (!BaseInstrument.CheckMusicianship(from))
                        {
                            from.SendLocalizedMessage(500612);                               // You play poorly, and there is no effect.
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);
                        }
                        else if (from.CheckTargetSkill(SkillName.Discordance, target, diff - 25.0, diff + 25.0))
                        {
                            from.SendLocalizedMessage(1049539);                                       // You play the song surpressing your targets strength
                            m_Instrument.PlayInstrumentWell(from);
                            m_Instrument.ConsumeUse(from);

                            ArrayList mods = new ArrayList();
                            int       effect;
                            double    scalar;

                            if (Core.AOS)
                            {
                                double discord = from.Skills[SkillName.Discordance].Value;

                                if (discord > 100.0)
                                {
                                    effect = -20 + (int)((discord - 100.0) / -2.5);
                                }
                                else
                                {
                                    effect = (int)(discord / -5.0);
                                }

                                if (Core.SE && BaseInstrument.GetBaseDifficulty(targ) >= 160.0)
                                {
                                    effect /= 2;
                                }

                                scalar = effect * 0.01;

                                mods.Add(new ResistanceMod(ResistanceType.Physical, effect));
                                mods.Add(new ResistanceMod(ResistanceType.Fire, effect));
                                mods.Add(new ResistanceMod(ResistanceType.Cold, effect));
                                mods.Add(new ResistanceMod(ResistanceType.Poison, effect));
                                mods.Add(new ResistanceMod(ResistanceType.Energy, effect));

                                for (int i = 0; i < targ.Skills.Length; ++i)
                                {
                                    if (targ.Skills[i].Value > 0)
                                    {
                                        mods.Add(new DefaultSkillMod((SkillName)i, true, targ.Skills[i].Value * scalar));
                                    }
                                }
                            }
                            else
                            {
                                effect = (int)(from.Skills[SkillName.Discordance].Value / -5.0);
                                scalar = effect * 0.01;

                                mods.Add(new StatMod(StatType.Str, "DiscordanceStr", (int)(targ.RawStr * scalar), TimeSpan.Zero));
                                mods.Add(new StatMod(StatType.Int, "DiscordanceInt", (int)(targ.RawInt * scalar), TimeSpan.Zero));
                                mods.Add(new StatMod(StatType.Dex, "DiscordanceDex", (int)(targ.RawDex * scalar), TimeSpan.Zero));

                                for (int i = 0; i < targ.Skills.Length; ++i)
                                {
                                    if (targ.Skills[i].Value > 0)
                                    {
                                        mods.Add(new DefaultSkillMod((SkillName)i, true, targ.Skills[i].Value * scalar));
                                    }
                                }
                            }

                            DiscordanceInfo info = new DiscordanceInfo(from, targ, Math.Abs(effect), mods);
                            info.m_Timer = Timer.DelayCall <DiscordanceInfo>(TimeSpan.Zero, TimeSpan.FromSeconds(1.25), new TimerStateCallback <DiscordanceInfo>(ProcessDiscordance), info);

                            m_Table[targ] = info;
                        }
                        else
                        {
                            from.SendLocalizedMessage(1049540);                              // You fail to disrupt your target
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);
                        }

                        from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(12.0);
                    }
                    else
                    {
                        m_Instrument.PlayInstrumentBadly(from);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1049535);                       // A song of discord would have no effect on that.
                }
            }
Esempio n. 22
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    from.SendLocalizedMessage(502816); // You feel that such an action would be inappropriate
                }
                else if (targeted is TrappableContainer targ)
                {
                    from.Direction = from.GetDirectionTo(targ);

                    if (targ.TrapType == TrapType.None)
                    {
                        from.SendLocalizedMessage(502373); // That doesn't appear to be trapped
                        return;
                    }

                    from.PlaySound(0x241);

                    if (from.CheckTargetSkill(SkillName.RemoveTrap, targ, targ.TrapPower, targ.TrapPower + 30))
                    {
                        targ.TrapPower = 0;
                        targ.TrapLevel = 0;
                        targ.TrapType  = TrapType.None;
                        from.SendLocalizedMessage(502377); // You successfully render the trap harmless
                    }
                    else
                    {
                        from.SendLocalizedMessage(502372); // You fail to disarm the trap... but you don't set it off
                    }
                }
                else if (targeted is BaseFactionTrap trap)
                {
                    Faction faction           = Faction.Find(from);
                    FactionTrapRemovalKit kit = from.Backpack?.FindItemByType <FactionTrapRemovalKit>();

                    bool isOwner = trap.Placer == from || trap.Faction?.IsCommander(from) == true;

                    if (faction == null)
                    {
                        from.SendLocalizedMessage(
                            1010538); // You may not disarm faction traps unless you are in an opposing faction
                    }
                    else if (trap.Faction != null && faction == trap.Faction && !isOwner)
                    {
                        from.SendLocalizedMessage(1010537); // You may not disarm traps set by your own faction!
                    }
                    else if (!isOwner && kit == null)
                    {
                        from.SendLocalizedMessage(
                            1042530); // You must have a trap removal kit at the base level of your pack to disarm a faction trap.
                    }
                    else
                    {
                        if ((Core.ML && isOwner) || (from.CheckTargetSkill(SkillName.RemoveTrap, trap, 80.0, 100.0) &&
                                                     from.CheckTargetSkill(SkillName.Tinkering, trap, 80.0, 100.0)))
                        {
                            from.PrivateOverheadMessage(MessageType.Regular, trap.MessageHue, trap.DisarmMessage,
                                                        from.NetState);

                            if (!isOwner)
                            {
                                int silver = faction.AwardSilver(from, trap.SilverFromDisarm);

                                if (silver > 0)
                                {
                                    from.SendLocalizedMessage(1008113, true,
                                                              silver.ToString(
                                                                  "N0")); // You have been granted faction silver for removing the enemy trap :
                                }
                            }

                            trap.Delete();
                        }
                        else
                        {
                            from.SendLocalizedMessage(502372); // You fail to disarm the trap... but you don't set it off
                        }

                        if (!isOwner)
                        {
                            kit.ConsumeCharge(from);
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502373); // That doesn't appear to be trapped
                }
            }
Esempio n. 23
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Ore.Deleted)
                {
                    return;
                }

                if (!from.InRange(m_Ore.GetWorldLocation(), 2))
                {
                    from.SendLocalizedMessage(501976); // The ore is too far away.
                    return;
                }

                #region Combine Ore
                if (targeted is BaseOre)
                {
                    BaseOre ore = (BaseOre)targeted;

                    if (!ore.Movable)
                    {
                        return;
                    }
                    else if (m_Ore == ore)
                    {
                        from.SendLocalizedMessage(501972); // Select another pile or ore with which to combine this.
                        from.Target = new InternalTarget(ore, from);
                        return;
                    }
                    else if (ore.Resource != m_Ore.Resource)
                    {
                        from.SendLocalizedMessage(501979); // You cannot combine ores of different metals.
                        return;
                    }

                    int worth = ore.Amount;

                    if (ore.ItemID == 0x19B9)
                    {
                        worth *= 8;
                    }
                    else if (ore.ItemID == 0x19B7)
                    {
                        worth *= 2;
                    }
                    else
                    {
                        worth *= 4;
                    }

                    int sourceWorth = m_Ore.Amount;

                    if (m_Ore.ItemID == 0x19B9)
                    {
                        sourceWorth *= 8;
                    }
                    else if (m_Ore.ItemID == 0x19B7)
                    {
                        sourceWorth *= 2;
                    }
                    else
                    {
                        sourceWorth *= 4;
                    }

                    worth += sourceWorth;

                    int plusWeight = 0;
                    int newID      = ore.ItemID;

                    if (ore.DefaultWeight != m_Ore.DefaultWeight)
                    {
                        if (ore.ItemID == 0x19B7 || m_Ore.ItemID == 0x19B7)
                        {
                            newID = 0x19B7;
                        }
                        else if (ore.ItemID == 0x19B9)
                        {
                            newID      = m_Ore.ItemID;
                            plusWeight = ore.Amount * 2;
                        }
                        else
                        {
                            plusWeight = m_Ore.Amount * 2;
                        }
                    }

                    if ((ore.ItemID == 0x19B9 && worth > 120000) || ((ore.ItemID == 0x19B8 || ore.ItemID == 0x19BA) && worth > 60000) || (ore.ItemID == 0x19B7 && worth > 30000))
                    {
                        from.SendLocalizedMessage(1062844); // There is too much ore to combine.
                        return;
                    }
                    else if (ore.RootParent is Mobile && (plusWeight + ((Mobile)ore.RootParent).Backpack.TotalWeight) > ((Mobile)ore.RootParent).Backpack.MaxWeight)
                    {
                        from.SendLocalizedMessage(501978); // The weight is too great to combine in a container.
                        return;
                    }

                    ore.ItemID = newID;

                    if (ore.ItemID == 0x19B9)
                    {
                        ore.Amount = worth / 8;
                        m_Ore.Delete();
                    }
                    else if (ore.ItemID == 0x19B7)
                    {
                        ore.Amount = worth / 2;
                        m_Ore.Delete();
                    }
                    else
                    {
                        ore.Amount = worth / 4;

                        m_Ore.Delete();
                    }
                    return;
                }
                #endregion

                if (IsForge(targeted))
                {
                    double difficulty;

                    switch (m_Ore.Resource)
                    {
                    default: difficulty = 50.0; break;

                    //daat99 OWLTR start - custom ores difficulty
                    case CraftResource.DullCopper: difficulty = 60.0; break;

                    case CraftResource.ShadowIron: difficulty = 65.0; break;

                    case CraftResource.Copper: difficulty = 70.0; break;

                    case CraftResource.Bronze: difficulty = 75.0; break;

                    case CraftResource.Gold: difficulty = 80.0; break;

                    case CraftResource.Agapite: difficulty = 85.0; break;

                    case CraftResource.Verite: difficulty = 90.0; break;

                    case CraftResource.Valorite: difficulty = 95.0; break;

                    case CraftResource.Blaze: difficulty = 100.0; break;

                    case CraftResource.Ice: difficulty = 105.0; break;

                    case CraftResource.Toxic: difficulty = 110.0; break;

                    case CraftResource.Electrum: difficulty = 115.0; break;

                    case CraftResource.Platinum: difficulty = 119.0; break;
                    }

                    double minSkill = difficulty - 25.0;
                    double maxSkill = difficulty + 25.0;

                    if (difficulty > 50.0 && difficulty > from.Skills[SkillName.Mining].Value)
                    {
                        from.SendLocalizedMessage(501986); // You have no idea how to smelt this strange ore!
                        return;
                    }

                    if (m_Ore.Amount <= 1 && m_Ore.ItemID == 0x19B7)
                    {
                        from.SendLocalizedMessage(501987); // There is not enough metal-bearing ore in this pile to make an ingot.
                        return;
                    }

                    if (from.CheckTargetSkill(SkillName.Mining, targeted, minSkill, maxSkill))
                    {
                        if (m_Ore.Amount <= 0)
                        {
                            from.SendLocalizedMessage(501987); // There is not enough metal-bearing ore in this pile to make an ingot.
                        }
                        else
                        {
                            int amount = m_Ore.Amount;
                            if (m_Ore.Amount > 30000)
                            {
                                amount = 30000;
                            }

                            BaseIngot ingot = m_Ore.GetIngot();

                            if (m_Ore.ItemID == 0x19B7)
                            {
                                if (m_Ore.Amount % 2 == 0)
                                {
                                    amount /= 2;
                                    m_Ore.Delete();
                                }
                                else
                                {
                                    amount      /= 2;
                                    m_Ore.Amount = 1;
                                }
                            }
                            else if (m_Ore.ItemID == 0x19B9)
                            {
                                amount *= 2;
                                m_Ore.Delete();
                            }
                            else
                            {
                                amount /= 1;
                                m_Ore.Delete();
                            }

                            ingot.Amount = amount;

                            from.AddToBackpack(ingot);
                            //from.PlaySound( 0x57 );

                            from.SendLocalizedMessage(501988); // You smelt the ore removing the impurities and put the metal in your backpack.
                        }
                    }
                    else if (m_Ore.Amount < 2 && m_Ore.ItemID == 0x19B9)
                    {
                        from.SendLocalizedMessage(501990);                           // You burn away the impurities but are left with less useable metal.
                        m_Ore.ItemID = 0x19B8;
                    }
                    else if (m_Ore.Amount < 2 && m_Ore.ItemID == 0x19B8 || m_Ore.ItemID == 0x19BA)
                    {
                        from.SendLocalizedMessage(501990);                           // You burn away the impurities but are left with less useable metal.
                        m_Ore.ItemID = 0x19B7;
                    }
                    else
                    {
                        from.SendLocalizedMessage(501990); // You burn away the impurities but are left with less useable metal.
                        m_Ore.Amount /= 2;
                    }
                }
            }
Esempio n. 24
0
            protected override void OnTick()
            {
                Mobile targ = m_Targeted;

                int    i = targ.Int;
                string intMsg;

                if (i < 11)
                {
                    intMsg = "slightly less intelligent than a rock";
                }
                else if (i < 21 && i > 10)
                {
                    intMsg = "fairly stupid";
                }
                else if (i < 31 && i > 20)
                {
                    intMsg = "not the brightest";
                }
                else if (i < 41 && i > 30)
                {
                    intMsg = "about average";
                }
                else if (i < 51 && i > 40)
                {
                    intMsg = "moderately intelligent";
                }
                else if (i < 61 && i > 50)
                {
                    intMsg = "very intelligent";
                }
                else if (i < 71 && i > 60)
                {
                    intMsg = "extraordinarily intelligent";
                }
                else if (i < 81 && i > 70)
                {
                    intMsg = "like a formidable intellect, well beyond the ordinary";
                }
                else if (i < 91 && i > 80)
                {
                    intMsg = "like a definite genius";
                }
                else
                {
                    intMsg = "superhumanly intelligent in a manner you cannot comprehend";
                }

                if (m_From.CheckTargetSkill(SkillName.EvalInt, targ, 0.0, 120.0))
                {
                    m_From.SendAsciiMessage("{0} looks {1}.", targ.Name, intMsg);
                }
                else
                {
                    string type;

                    if (m_Targeted.Body.IsHuman)
                    {
                        if (m_Targeted.Body.IsMale)
                        {
                            type = "his";
                        }
                        else
                        {
                            type = "hers";
                        }
                    }
                    else
                    {
                        type = "its";
                    }

                    m_From.SendAsciiMessage("You cannot judge {0} mental abilities.", type);
                }

                if (m_From is PlayerMobile)
                {
                    ((PlayerMobile)m_From).EndPlayerAction();
                }
            }
Esempio n. 25
0
            protected override void OnTarget(Mobile from, object targetyouselect)
            {
                if (targetyouselect is Item)
                {
                    if (from.CheckTargetSkill(SkillName.ItemID, targetyouselect, 0, 100))
                    {
                        if (((Item)targetyouselect).IsChildOf(from.Backpack))
                        {
                            if (targetyouselect is BaseWeapon && ((BaseWeapon)targetyouselect).SkillBonuses.Skill_1_Value < 1)   //or <= if will let to 2 also
                            {
                                ((BaseWeapon)targetyouselect).SkillBonuses.SetValues(0, SkillName.EvalInt, 1);
                            }
                            else if (targetyouselect is BaseArmor && ((BaseArmor)targetyouselect).SkillBonuses.Skill_1_Value < 1)   //or <= if will let to 2 also
                            {
                                ((BaseArmor)targetyouselect).SkillBonuses.SetValues(0, SkillName.EvalInt, 1);
                            }
                            else if (targetyouselect is BaseJewel && ((BaseJewel)targetyouselect).SkillBonuses.Skill_1_Value < 1)   //or <= if will let to 2 also
                            {
                                ((BaseJewel)targetyouselect).SkillBonuses.SetValues(0, SkillName.EvalInt, 1);
                            }
                            else if (targetyouselect is BaseClothing && ((BaseClothing)targetyouselect).SkillBonuses.Skill_1_Value < 1)   //or <= if will let to 2 also
                            {
                                ((BaseClothing)targetyouselect).SkillBonuses.SetValues(0, SkillName.EvalInt, 1);
                            }
                            else if (targetyouselect is BaseWeapon && ((BaseWeapon)targetyouselect).SkillBonuses.Skill_2_Value < 1)   //or <= if will let to 2 also
                            {
                                ((BaseWeapon)targetyouselect).SkillBonuses.SetValues(1, SkillName.EvalInt, 1);
                            }
                            else if (targetyouselect is BaseArmor && ((BaseArmor)targetyouselect).SkillBonuses.Skill_2_Value < 1)   //or <= if will let to 2 also
                            {
                                ((BaseArmor)targetyouselect).SkillBonuses.SetValues(1, SkillName.EvalInt, 1);
                            }
                            else if (targetyouselect is BaseJewel && ((BaseJewel)targetyouselect).SkillBonuses.Skill_2_Value < 1)   //or <= if will let to 2 also
                            {
                                ((BaseJewel)targetyouselect).SkillBonuses.SetValues(1, SkillName.EvalInt, 1);
                            }
                            else if (targetyouselect is BaseClothing && ((BaseClothing)targetyouselect).SkillBonuses.Skill_2_Value < 1)   //or <= if will let to 2 also
                            {
                                ((BaseClothing)targetyouselect).SkillBonuses.SetValues(1, SkillName.EvalInt, 1);
                            }
                            else
                            {
                                from.SendMessage("That can not be enhanced.");
                                return; //continue might work also
                            }

                            from.SendMessage("You Successfully enhance the Item.");
                            from.PlaySound(Utility.Random(0x520, 0));
                            m_cOrb.Delete();
                        }
                        else
                        {
                            from.SendMessage("The target item must be in your backpack to use this.");
                            return; //continue might work also
                        }
                    }
                    else
                    {
                        from.SendMessage("You fail to enhance the item. Try again."); // You cannot augment that...
                    }
                }
                else if (targetyouselect is Mobile)
                {
                    ((Mobile)targetyouselect).OnSingleClick(from);
                }
                else
                {
                    from.SendMessage("You can only enhance Weapons, Armors, Jewlery, or Clothing.");
                }
            }
Esempio n. 26
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (from == targeted)
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500910); // Hmm, that person looks really silly.
                }
                else if (targeted is TownCrier)
                {
                    ((TownCrier)targeted).PrivateOverheadMessage(MessageType.Regular, 0x3B2, 500907, from.NetState); // He looks smart enough to remember the news.  Ask him about it.
                }
                else if (targeted is BaseVendor && ((BaseVendor)targeted).IsInvulnerable)
                {
                    ((BaseVendor)targeted).PrivateOverheadMessage(MessageType.Regular, 0x3B2, 500909, from.NetState); // That person could probably calculate the cost of what you buy from them.
                }
                else if (targeted is Mobile targ)
                {
                    int marginOfError = Math.Max(0, 20 - (int)(from.Skills[SkillName.EvalInt].Value / 5));

                    int intel = targ.Int + Utility.RandomMinMax(-marginOfError, +marginOfError);
                    int mana  = ((targ.Mana * 100) / Math.Max(targ.ManaMax, 1)) + Utility.RandomMinMax(-marginOfError, +marginOfError);

                    int intMod = intel / 10;
                    int mnMod  = mana / 10;

                    if (intMod > 10)
                    {
                        intMod = 10;
                    }
                    else if (intMod < 0)
                    {
                        intMod = 0;
                    }

                    if (mnMod > 10)
                    {
                        mnMod = 10;
                    }
                    else if (mnMod < 0)
                    {
                        mnMod = 0;
                    }

                    int body;

                    if (targ.Body.IsHuman)
                    {
                        body = targ.Female ? 11 : 0;
                    }
                    else
                    {
                        body = 22;
                    }

                    if (from.CheckTargetSkill(SkillName.EvalInt, targ, 0.0, 120.0))
                    {
                        targ.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1038169 + intMod + body, from.NetState); // He/She/It looks [slighly less intelligent than a rock.]  [Of Average intellect] [etc...]

                        if (from.Skills[SkillName.EvalInt].Base >= 76.0)
                        {
                            targ.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1038202 + mnMod, from.NetState); // That being is at [10,20,...] percent mental strength.
                        }
                    }
                    else
                    {
                        targ.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1038166 + (body / 11), from.NetState); // You cannot judge his/her/its mental abilities.
                    }
                }
                else if (targeted is Item)
                {
                    ((Item)targeted).SendLocalizedMessageTo(from, 500908, ""); // It looks smarter than a rock, but dumber than a piece of wood.
                }
            }
Esempio n. 27
0
                protected override void OnTick()
                {
                    Container theirPack = m_Target.Backpack;

                    double badKarmaChance = 0.5 - ((double)m_From.Karma / 8570);

                    if (theirPack == null)
                    {
                        m_From.SendLocalizedMessage(500404);                           // They seem unwilling to give you any money.
                    }
                    else if (m_From.Karma < 0 && badKarmaChance > Utility.RandomDouble())
                    {
                        m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500406);                           // Thou dost not look trustworthy... no gold for thee today!
                    }
                    else if (m_From.CheckTargetSkill(SkillName.Begging, m_Target, 0.0, 100.0))
                    {
                        int toConsume = theirPack.GetAmount(typeof(Gold)) / 10;
                        int max       = 10 + (m_From.Fame / 2500);

                        if (max > 14)
                        {
                            max = 14;
                        }
                        else if (max < 10)
                        {
                            max = 10;
                        }

                        if (toConsume > max)
                        {
                            toConsume = max;
                        }

                        if (toConsume > 0)
                        {
                            int consumed = theirPack.ConsumeUpTo(typeof(Gold), toConsume);

                            if (consumed > 0)
                            {
                                m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500405);                                   // I feel sorry for thee...

                                Gold gold = new Gold(consumed);

                                m_From.AddToBackpack(gold);
                                m_From.PlaySound(gold.GetDropSound());

                                if (m_From.Karma > -3000)
                                {
                                    int toLose = m_From.Karma + 3000;

                                    if (toLose > 40)
                                    {
                                        toLose = 40;
                                    }

                                    Titles.AwardKarma(m_From, -toLose, true);
                                }
                            }
                            else
                            {
                                m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500407);                                   // I have not enough money to give thee any!
                            }
                        }
                        else
                        {
                            m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500407);                               // I have not enough money to give thee any!
                        }
                    }
                    else
                    {
                        m_Target.SendLocalizedMessage(500404);                           // They seem unwilling to give you any money.
                    }

                    m_From.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(10.0);
                }
Esempio n. 28
0
            private Item TryStealItem(Item toSteal, ref bool caught)
            {
                Item stolen = null;

                object root = toSteal.RootParent;

                if (!IsEmptyHanded(m_Thief))
                {
                    m_Thief.SendLocalizedMessage(1005584);                     // Both hands must be free to steal.
                }
                else if (root is Mobile && ((Mobile)root).Player && !IsInGuild(m_Thief))
                {
                    m_Thief.SendLocalizedMessage(1005596);                     // You must be in the thieves guild to steal from other players.
                }
                else if (SuspendOnMurder && root is Mobile && ((Mobile)root).Player && IsInGuild(m_Thief) && m_Thief.Kills > 0)
                {
                    m_Thief.SendLocalizedMessage(502706);                     // You are currently suspended from the thieves guild.
                }
                else if (root is BaseVendor && ((BaseVendor)root).IsInvulnerable)
                {
                    m_Thief.SendLocalizedMessage(1005598);                     // You can't steal from shopkeepers.
                }
                else if (root is PlayerVendor)
                {
                    m_Thief.SendLocalizedMessage(502709);                     // You can't steal from vendors.
                }
                else if (!m_Thief.CanSee(toSteal))
                {
                    m_Thief.SendLocalizedMessage(500237);                     // Target can not be seen.
                }
                else if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, toSteal, false, true))
                {
                    m_Thief.SendLocalizedMessage(1048147);                     // Your backpack can't hold anything else.
                }
                #region Sigils
                else if (toSteal is Sigil)
                {
                    PlayerState pl      = PlayerState.Find(m_Thief);
                    Faction     faction = (pl == null ? null : pl.Faction);

                    Sigil sig = (Sigil)toSteal;

                    if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1))
                    {
                        m_Thief.SendLocalizedMessage(502703);  // You must be standing next to an item to steal it.
                    }
                    else if (root != null)                     // not on the ground
                    {
                        m_Thief.SendLocalizedMessage(502710);  // You can't steal that!
                    }
                    else if (faction != null)
                    {
                        if (!m_Thief.CanBeginAction(typeof(IncognitoSpell)))
                        {
                            m_Thief.SendLocalizedMessage(1010581);                             //	You cannot steal the sigil when you are incognito
                        }
                        else if (DisguiseTimers.IsDisguised(m_Thief))
                        {
                            m_Thief.SendLocalizedMessage(1010583);                             //	You cannot steal the sigil while disguised
                        }
                        else if (!m_Thief.CanBeginAction(typeof(PolymorphSpell)))
                        {
                            m_Thief.SendLocalizedMessage(1010582);                             //	You cannot steal the sigil while polymorphed
                        }
                        else if (TransformationSpellHelper.UnderTransformation(m_Thief))
                        {
                            m_Thief.SendLocalizedMessage(1061622);                             // You cannot steal the sigil while in that form.
                        }
                        else if (pl.IsLeaving)
                        {
                            m_Thief.SendLocalizedMessage(1005589);                             // You are currently quitting a faction and cannot steal the town sigil
                        }
                        else if (sig.IsBeingCorrupted && sig.LastMonolith.Faction == faction)
                        {
                            m_Thief.SendLocalizedMessage(1005590);                             //	You cannot steal your own sigil
                        }
                        else if (sig.IsPurifying)
                        {
                            m_Thief.SendLocalizedMessage(1005592);                             // You cannot steal this sigil until it has been purified
                        }
                        else if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, 80.0, 80.0))
                        {
                            if (Sigil.ExistsOn(m_Thief))
                            {
                                m_Thief.SendLocalizedMessage(1010258);
                                //	The sigil has gone back to its home location because you already have a sigil.
                            }
                            else if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, sig, false, true))
                            {
                                m_Thief.SendLocalizedMessage(1010259);                                 //	The sigil has gone home because your backpack is full
                            }
                            else
                            {
                                if (sig.IsBeingCorrupted)
                                {
                                    sig.GraceStart = DateTime.UtcNow;                                     // begin grace period
                                }

                                m_Thief.SendLocalizedMessage(1010586);                                 // YOU STOLE THE SIGIL!!!   (woah, calm down now)

                                if (sig.LastMonolith != null && sig.LastMonolith.Sigil != null)
                                {
                                    sig.LastMonolith.Sigil = null;
                                    sig.LastStolen         = DateTime.UtcNow;
                                }

                                return(sig);
                            }
                        }
                        else
                        {
                            m_Thief.SendLocalizedMessage(1005594);                             //	You do not have enough skill to steal the sigil
                        }
                    }
                    else
                    {
                        m_Thief.SendLocalizedMessage(1005588);                         //	You must join a faction to do that
                    }
                }
                #endregion

                else if ((toSteal.Parent == null || !toSteal.Movable) && !ItemFlags.GetStealable(toSteal))
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                else if ((toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed(root)) && !ItemFlags.GetStealable(toSteal))
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                else if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1))
                {
                    m_Thief.SendLocalizedMessage(502703);                     // You must be standing next to an item to steal it.
                }
                else if (m_Thief.Skills[SkillName.Stealing].Value < 100.0)
                {
                    m_Thief.SendLocalizedMessage(1060025, "", 0x66D);                     // You're not skilled enough to attempt the theft of this item.
                }
                else if (toSteal.Parent is Mobile)
                {
                    m_Thief.SendLocalizedMessage(1005585);                     // You cannot steal items which are equiped.
                }
                else if (root == m_Thief)
                {
                    m_Thief.SendLocalizedMessage(502704);                     // You catch yourself red-handed.
                }
                else if (root is Mobile && ((Mobile)root).IsStaff())
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                else if (root is Mobile && !m_Thief.CanBeHarmful((Mobile)root))
                {
                }
                else if (root is Corpse)
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                else
                {
                    double w = toSteal.Weight + toSteal.TotalWeight;

                    if (w > 10)
                    {
                        m_Thief.SendMessage("That is too heavy to steal.");
                    }
                    else
                    {
                        if (toSteal.Stackable && toSteal.Amount > 1)
                        {
                            int maxAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight);

                            if (maxAmount < 1)
                            {
                                maxAmount = 1;
                            }
                            else if (maxAmount > toSteal.Amount)
                            {
                                maxAmount = toSteal.Amount;
                            }

                            int amount = Utility.RandomMinMax(1, maxAmount);

                            if (amount >= toSteal.Amount)
                            {
                                int pileWeight = (int)Math.Ceiling(toSteal.Weight * toSteal.Amount);
                                pileWeight *= 10;

                                if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5))
                                {
                                    stolen = toSteal;
                                }
                            }
                            else
                            {
                                int pileWeight = (int)Math.Ceiling(toSteal.Weight * amount);
                                pileWeight *= 10;

                                if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5))
                                {
                                    stolen = Mobile.LiftItemDupe(toSteal, toSteal.Amount - amount);

                                    if (stolen == null)
                                    {
                                        stolen = toSteal;
                                    }
                                }
                            }
                        }
                        else
                        {
                            int iw = (int)Math.Ceiling(w);
                            iw *= 10;

                            if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5))
                            {
                                stolen = toSteal;
                            }
                        }

                        // Non-movable stealable items cannot result in the stealer getting caught
                        if (stolen != null && stolen.Movable)
                        {
                            caught = (m_Thief.Skills[SkillName.Stealing].Value < Utility.Random(150));
                        }
                        else
                        {
                            caught = false;
                        }

                        if (stolen != null)
                        {
                            m_Thief.SendLocalizedMessage(502724);                             // You succesfully steal the item.

                            ItemFlags.SetTaken(stolen, true);
                            ItemFlags.SetStealable(stolen, false);
                            stolen.Movable = true;
                        }
                        else
                        {
                            m_Thief.SendLocalizedMessage(502723);                             // You fail to steal the item.
                        }
                    }
                }

                return(stolen);
            }
Esempio n. 29
0
                protected override void OnTick()
                {
                    Container theirPack = m_Target.Backpack;

                    if (theirPack == null)
                    {
                        m_From.SendLocalizedMessage(500404); // They seem unwilling to give you any money.
                    }
                    else if (m_From.CheckTargetSkill(SkillName.Begging, m_Target, 0.0, 120.0, 1.0))
                    {
                        int toConsume = theirPack.GetAmount(typeof(Gold)) / 10;
                        int max       = 10 + (m_From.Fame / 2500);

                        if (max > 14)
                        {
                            max = 14;
                        }

                        else if (max < 10)
                        {
                            max = 10;
                        }

                        if (toConsume > max)
                        {
                            toConsume = max;
                        }

                        if (toConsume > 0)
                        {
                            int consumed = theirPack.ConsumeUpTo(typeof(Gold), toConsume);

                            if (consumed > 0)
                            {
                                m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500405); // I feel sorry for thee...

                                Gold gold = new Gold(consumed);

                                m_From.AddToBackpack(gold);

                                //TEST: REDO

                                /*
                                 * if (m_From.Skills.Begging.Value == 100)
                                 * {
                                 *  var randomNumber = Utility.RandomMinMax(1, 100);
                                 *
                                 *  if (randomNumber <= 75) //75% chance
                                 *  {
                                 *      switch (Utility.Random(2))
                                 *      {
                                 *          case 0: m_From.AddToBackpack(new Pitcher(BeverageType.Water)); break;
                                 *
                                 *          default: m_From.AddToBackpack(new FrenchBread()); break;
                                 *      }
                                 *  }
                                 *
                                 *  else if (randomNumber <= 99) //24% chance
                                 *  {
                                 *      switch (Utility.Random(7))
                                 *      {
                                 *          case 0: m_From.AddToBackpack(new Lantern()); break;
                                 *          case 1: m_From.AddToBackpack(new CheesePizza()); break;
                                 *          case 2: m_From.AddToBackpack(new WoodenBowlOfStew()); break;
                                 *          case 3: m_From.AddToBackpack(new CheeseWedge()); break;
                                 *          case 4: m_From.AddToBackpack(new Dates()); break;
                                 *          case 5: m_From.AddToBackpack(new Shirt()); break;
                                 *
                                 *          default: m_From.AddToBackpack(new Pitcher(BeverageType.Liquor)); break;
                                 *      }
                                 *  }
                                 *
                                 *  else // 1% chance
                                 *  {
                                 *      switch (Utility.RandomMinMax(1, 6))
                                 *      {
                                 *          case 1: m_From.AddToBackpack(new Bedroll()); break;
                                 *          case 2: m_From.AddToBackpack(new Pitcher(BeverageType.Wine)); break;
                                 *          case 3: m_From.AddToBackpack(new BeverageBottle(BeverageType.Wine)); break;
                                 *          case 4: m_From.AddToBackpack(new FlowerGarland()); break;
                                 *          case 5: m_From.AddToBackpack(new FishingPole()); break;
                                 *          case 6: m_From.AddToBackpack(new Turnip()); break;
                                 *      }
                                 *  }
                                 * }
                                 */

                                m_From.PlaySound(gold.GetDropSound());

                                if (m_From.Karma > -3000)
                                {
                                    int toLose = m_From.Karma + 3000;

                                    if (toLose > 40)
                                    {
                                        toLose = 40;
                                    }

                                    FameKarmaTitles.AwardKarma(m_From, -toLose, true);
                                }
                            }

                            else
                            {
                                m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500407); // I have not enough money to give thee any!
                            }
                        }

                        else
                        {
                            m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500407); // I have not enough money to give thee any!
                        }
                        m_From.NextSkillTime = Core.TickCount + (int)(SkillCooldown.BeggingSuccessCooldown * 1000);
                    }

                    else
                    {
                        m_From.SendLocalizedMessage(500404); // They seem unwilling to give you any money.
                        m_From.NextSkillTime = Core.TickCount + (int)(SkillCooldown.BeggingFailureCooldown * 1000);
                    }
                }
Esempio n. 30
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    from.SendLocalizedMessage(502816);                       // You feel that such an action would be inappropriate.
                }
                else if (targeted is Food)
                {
                    Food food = (Food)targeted;

                    if (from.CheckTargetSkill(SkillName.TasteID, food, 0, 100))
                    {
                        if (food.Poison != null)
                        {
                            food.SendLocalizedMessageTo(from, 1038284);                               // It appears to have poison smeared on it.
                        }
                        else
                        {
                            // No poison on the food
                            food.SendLocalizedMessageTo(from, 1010600);                               // You detect nothing unusual about this substance.
                        }
                    }
                    else
                    {
                        // Skill check failed
                        food.SendLocalizedMessageTo(from, 502823);                           // You cannot discern anything about this substance.
                    }
                }
                else if (targeted is BasePotion)
                {
                    BasePotion potion = (BasePotion)targeted;

                    potion.SendLocalizedMessageTo(from, 502813);                       // You already know what kind of potion that is.
                    potion.SendLocalizedMessageTo(from, potion.LabelNumber);
                }
                else if (targeted is PotionKeg)
                {
                    PotionKeg keg = (PotionKeg)targeted;

                    if (keg.Held <= 0)
                    {
                        keg.SendLocalizedMessageTo(from, 502228);                           // There is nothing in the keg to taste!
                    }
                    else
                    {
                        keg.SendLocalizedMessageTo(from, 502229);                           // You are already familiar with this keg's contents.
                        keg.SendLocalizedMessageTo(from, keg.LabelNumber);
                    }
                }
                else if (targeted is Seed)
                {
                    Seed seed = (Seed)targeted;
                    if (from.CheckTargetSkill(SkillName.TasteID, seed, 80, 100))
                    {
                        seed.ShowType = true;
                        from.SendMessage("You identified the seed type as {0}", seed.PlantType);
                    }
                    else
                    {
                        from.SendMessage("You can't determine what seed type this is");
                    }
                }
                else
                {
                    // The target is not food or potion or potion keg.
                    from.SendLocalizedMessage(502820);                     // That's not something you can taste.
                }
            }
Esempio n. 31
0
            protected override void OnTarget(Mobile src, object targ)
            {
                bool foundAnyone = false;

                Point3D p;

                if (targ is Mobile)
                {
                    p = ((Mobile)targ).Location;
                }
                else if (targ is Item)
                {
                    p = ((Item)targ).Location;
                }
                else if (targ is IPoint3D)
                {
                    p = new Point3D((IPoint3D)targ);
                }
                else
                {
                    p = src.Location;
                }

                double srcSkill = src.Skills[SkillName.DetectHidden].Value;
                int    range    = (int)(srcSkill / 10.0);

                if (!src.CheckSkill(SkillName.DetectHidden, 0.0, 100.0))
                {
                    range /= 2;
                }

                BaseHouse house = BaseHouse.FindHouseAt(p, src.Map, 16);

                bool inHouse = (house != null && house.IsFriend(src));

                if (inHouse)
                {
                    range = 22;
                }

                if (range > 0)
                {
                    IPooledEnumerable inRange = src.Map.GetMobilesInRange(p, range);

                    foreach (Mobile trg in inRange)
                    {
                        if (trg.Hidden && src != trg)
                        {
                            double ss = srcSkill + Utility.Random(21) - 10;
                            double ts = trg.Skills[SkillName.Hiding].Value + Utility.Random(21) - 10;

                            if (src.AccessLevel >= trg.AccessLevel && (ss >= ts || (inHouse && house.IsInside(trg))))
                            {
                                if (trg is ShadowKnight && (trg.X != p.X || trg.Y != p.Y))
                                {
                                    continue;
                                }

                                trg.RevealingAction();
                                trg.SendLocalizedMessage(500814);                                   // You have been revealed!
                                foundAnyone = true;
                            }
                        }
                    }

                    inRange.Free();

                    if (Faction.Find(src) != null)
                    {
                        IPooledEnumerable itemsInRange = src.Map.GetItemsInRange(p, range);

                        foreach (Item item in itemsInRange)
                        {
                            if (item is BaseFactionTrap)
                            {
                                BaseFactionTrap trap = (BaseFactionTrap)item;

                                if (src.CheckTargetSkill(SkillName.DetectHidden, trap, 80.0, 100.0))
                                {
                                    src.SendLocalizedMessage(1042712, true, " " + (trap.Faction == null ? "" : trap.Faction.Definition.FriendlyName));                                       // You reveal a trap placed by a faction:

                                    trap.Visible = true;
                                    trap.BeginConceal();

                                    foundAnyone = true;
                                }
                            }
                        }

                        itemsInRange.Free();
                    }
                }

                if (!foundAnyone)
                {
                    src.SendLocalizedMessage(500817);                       // You can see nothing hidden there.
                }
            }
                protected override void OnTarget( Mobile from, object targ )
                {
                    if ( targ is IPoint2D )
                    {
                        double min = m_Creature.MinTameSkill - 30;
                        double max = m_Creature.MinTameSkill + 30 + Utility.Random( 10 );

                        if ( max <= from.Skills[ SkillName.Herding ].Value )
                            m_Creature.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 502471, from.NetState ); // That wasn't even challenging.

                        if ( from.CheckTargetSkill( SkillName.Herding, m_Creature, min, max ) )
                        {
                            IPoint2D p = (IPoint2D) targ;

                            if ( targ != from )
                                p = new Point2D( p.X, p.Y );

                            m_Creature.TargetLocation = p;
                            from.SendLocalizedMessage( 502479 ); // The animal walks where it was instructed to.
                        }
                        else
                        {
                            from.SendLocalizedMessage( 502472 ); // You don't seem to be able to persuade that to move.
                        }
                    }
                }
Esempio n. 33
0
                protected override void OnTick()
                {
                    m_Count++;

                    DamageEntry de           = m_Creature.FindMostRecentDamageEntry(false);
                    bool        alreadyOwned = m_Creature.Owners.Contains(m_Tamer);

                    if (!m_Tamer.InRange(m_Creature, 6))
                    {
                        m_BeingTamed.Remove(m_Creature);
                        m_Tamer.NextSkillTime = DateTime.Now;
                        m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502795, m_Tamer.NetState);                           // You are too far away to continue taming.
                        Stop();
                    }
                    else if (!m_Tamer.CheckAlive())
                    {
                        m_BeingTamed.Remove(m_Creature);
                        m_Tamer.NextSkillTime = DateTime.Now;
                        m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502796, m_Tamer.NetState);                           // You are dead, and cannot continue taming.
                        Stop();
                    }
                    else if (!m_Tamer.CanSee(m_Creature) || !m_Tamer.InLOS(m_Creature) || !CanPath())
                    {
                        m_BeingTamed.Remove(m_Creature);
                        m_Tamer.NextSkillTime = DateTime.Now;
                        m_Tamer.SendLocalizedMessage(1049654);                           // You do not have a clear path to the animal you are taming, and must cease your attempt.
                        Stop();
                    }
                    else if (!m_Creature.Tamable)
                    {
                        m_BeingTamed.Remove(m_Creature);
                        m_Tamer.NextSkillTime = DateTime.Now;
                        m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1049655, m_Tamer.NetState);                           // That creature cannot be tamed.
                        Stop();
                    }
                    else if (m_Creature.Controlled)
                    {
                        m_BeingTamed.Remove(m_Creature);
                        m_Tamer.NextSkillTime = DateTime.Now;
                        m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502804, m_Tamer.NetState);                           // That animal looks tame already.
                        Stop();
                    }
                    else if (m_Creature.Owners.Count >= BaseCreature.MaxOwners && !m_Creature.Owners.Contains(m_Tamer))
                    {
                        m_BeingTamed.Remove(m_Creature);
                        m_Tamer.NextSkillTime = DateTime.Now;
                        m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1005615, m_Tamer.NetState);                           // This animal has had too many owners and is too upset for you to tame.
                        Stop();
                    }
                    else if (MustBeSubdued(m_Creature))
                    {
                        m_BeingTamed.Remove(m_Creature);
                        m_Tamer.NextSkillTime = DateTime.Now;
                        m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1054025, m_Tamer.NetState);                           // You must subdue this creature before you can tame it!
                        Stop();
                    }
                    else if (de != null && de.LastDamage > m_StartTime)
                    {
                        m_BeingTamed.Remove(m_Creature);
                        m_Tamer.NextSkillTime = DateTime.Now;
                        m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502794, m_Tamer.NetState);                           // The animal is too angry to continue taming.
                        Stop();
                    }
                    else if (m_Count < m_MaxCount)
                    {
                        m_Tamer.RevealingAction();

                        switch (Utility.Random(3))
                        {
                        case 0: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(502790, 4)); break;

                        case 1: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(1005608, 6)); break;

                        case 2: m_Tamer.PublicOverheadMessage(MessageType.Regular, 0x3B2, Utility.Random(1010593, 4)); break;
                        }

                        if (!alreadyOwned)                           // Passively check animal lore for gain
                        {
                            m_Tamer.CheckTargetSkill(SkillName.AnimalLore, m_Creature, 0.0, 120.0);
                        }

                        if (m_Creature.Paralyzed)
                        {
                            m_Paralyzed = true;
                        }
                    }
                    else
                    {
                        m_Tamer.RevealingAction();
                        m_Tamer.NextSkillTime = DateTime.Now;
                        m_BeingTamed.Remove(m_Creature);

                        if (m_Creature.Paralyzed)
                        {
                            m_Paralyzed = true;
                        }

                        if (!alreadyOwned)                           // Passively check animal lore for gain
                        {
                            m_Tamer.CheckTargetSkill(SkillName.AnimalLore, m_Creature, 0.0, 120.0);
                        }

                        double minSkill = m_Creature.MinTameSkill + m_Creature.Owners.Count * 6.0;

                        minSkill += 24.9;

                        if (alreadyOwned || m_Tamer.CheckTargetSkill(SkillName.AnimalTaming, m_Creature, minSkill - 25.0, minSkill + 25.0))
                        {
                            if (m_Creature.Owners.Count == 0)                               // First tame
                            {
                                if (m_Paralyzed)
                                {
                                    ScaleSkills(m_Creature, 0.86);                                       // 86% of original skills if they were paralyzed during the taming
                                }
                                else
                                {
                                    ScaleSkills(m_Creature, 0.90);                                       // 90% of original skills
                                }
                                if (m_Creature.StatLossAfterTame)
                                {
                                    ScaleStats(m_Creature, 0.50);
                                }
                            }

                            if (alreadyOwned)
                            {
                                m_Tamer.SendLocalizedMessage(502797);                                   // That wasn't even challenging.
                            }
                            else
                            {
                                m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502799, m_Tamer.NetState);                                   // It seems to accept you as master.
                                m_Creature.Owners.Add(m_Tamer);
                            }

                            m_Creature.SetControlMaster(m_Tamer);
                            m_Creature.IsBonded = false;
                        }
                        else
                        {
                            m_Creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502798, m_Tamer.NetState);                               // You fail to tame the creature.
                        }
                    }
                }
Esempio n. 34
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                from.RevealingAction();

                if (targeted is BaseCreature)
                {
                    BaseCreature creature = (BaseCreature)targeted;

                    if (!this.m_Instrument.IsChildOf(from.Backpack))
                    {
                        from.SendLocalizedMessage(1062488); // The instrument you are trying to play is no longer in your backpack!
                    }
                    else if (this.m_Creature.Unprovokable)
                    {
                        from.SendLocalizedMessage(1049446); // You have no chance of provoking those creatures.
                    }
                    else if (creature.Unprovokable && !(creature is DemonKnight))
                    {
                        from.SendLocalizedMessage(1049446); // You have no chance of provoking those creatures.
                    }
                    else if (this.m_Creature.Map != creature.Map || !this.m_Creature.InRange(creature, BaseInstrument.GetBardRange(from, SkillName.Provocation)))
                    {
                        from.SendLocalizedMessage(1049450); // The creatures you are trying to provoke are too far away from each other for your music to have an effect.
                    }
                    else if (this.m_Creature != creature)
                    {
                        from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(10.0);

                        double diff = ((this.m_Instrument.GetDifficultyFor(this.m_Creature) + this.m_Instrument.GetDifficultyFor(creature)) * 0.5) - 5.0;
                        double music = from.Skills[SkillName.Musicianship].Value;

                        if (music > 100.0)
                            diff -= (music - 100.0) * 0.5;

                        if (from.CanBeHarmful(this.m_Creature, true) && from.CanBeHarmful(creature, true))
                        {
                            if (!BaseInstrument.CheckMusicianship(from))
                            {
                                from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(5.0);
                                from.SendLocalizedMessage(500612); // You play poorly, and there is no effect.
                                this.m_Instrument.PlayInstrumentBadly(from);
                                this.m_Instrument.ConsumeUse(from);
                            }
                            else
                            {
                                //from.DoHarmful( m_Creature );
                                //from.DoHarmful( creature );
                                if (!from.CheckTargetSkill(SkillName.Provocation, creature, diff - 25.0, diff + 25.0))
                                {
                                    from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(5.0);
                                    from.SendLocalizedMessage(501599); // Your music fails to incite enough anger.
                                    this.m_Instrument.PlayInstrumentBadly(from);
                                    this.m_Instrument.ConsumeUse(from);
                                }
                                else
                                {
                                    from.SendLocalizedMessage(501602); // Your music succeeds, as you start a fight.
                                    this.m_Instrument.PlayInstrumentWell(from);
                                    this.m_Instrument.ConsumeUse(from);
                                    this.m_Creature.Provoke(from, creature, true);
                                }
                            }
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(501593); // You can't tell someone to attack themselves!
                    }
                }
                else
                {
                    from.SendLocalizedMessage(501589); // You can't incite that!
                }
            }
Esempio n. 35
0
                    protected override void OnTick()
                    {
                        string DisplayName = "rag";

                        if (m_From.CheckTargetSkill(SkillName.Poisoning, m_Target, m_MinSkill, m_MaxSkill))
                        {
                            if (m_Target is Food)
                            {
                                ((Food)m_Target).Poison = m_Poison;
                                DisplayName             = "food item";
                            }
                            else if (m_Target is BaseBeverage)
                            {
                                ((BaseBeverage)m_Target).Poison = m_Poison;
                                if (((BaseBeverage)m_Target).Quantity > 3)
                                {
                                    m_From.SendMessage("You pour out some of the contents to make room for the poison.");
                                    ((BaseBeverage)m_Target).Quantity = 3;
                                }
                                DisplayName = "beverage item";
                            }
                            else if (m_Target is BaseWeapon)
                            {
                                ((BaseWeapon)m_Target).Poison        = m_Poison;
                                ((BaseWeapon)m_Target).PoisonCharges = 18 - (m_Poison.Level * 2);
                                DisplayName = ((BaseWeapon)m_Target).ItemData.Name;
                            }
                            else if (m_Target is Cloth)
                            {
                                // Only create the poison rag if the cloth is a single piece
                                if (((Cloth)m_Target).Amount == 1)
                                {
                                    // delete the cloth
                                    ((Cloth)m_Target).Delete();

                                    // Create the poison soaked rag (PoisonCloth type)
                                    PoisonCloth PCloth = new PoisonCloth();

                                    // Standard weapon poisoning parameters
                                    PCloth.Poison        = m_Poison;
                                    PCloth.PoisonCharges = 18 - (m_Poison.Level * 2);
                                    // This is where to adjust the additional delay for time it
                                    // takes to poison an arrow before it can be fired
                                    PCloth.Delay = 0;

                                    // Add the poison soaked rag to players backpack
                                    m_From.AddToBackpack(PCloth);
                                }
                            }
                            switch (m_Poison.Level)
                            {
                            case 0:
                                m_From.SendMessage("You apply the lesser poison to the " + DisplayName);
                                break;

                            case 1:
                                m_From.SendMessage("You apply the poison to the " + DisplayName);
                                break;

                            case 2:
                                m_From.SendMessage("You apply the greater poison to the " + DisplayName);
                                break;

                            case 3:
                                m_From.SendMessage("You apply the deadly poison to the " + DisplayName);
                                break;

                            case 4:
                                m_From.SendMessage("You apply the lethal poison to the " + DisplayName);
                                break;

                            default:
                                m_From.SendMessage("You apply the poison to the " + DisplayName);
                                break;
                            }
                            // Removed localized poisoning message and replaced with a
                            // more specific message based on the poison used
                            //m_From.SendLocalizedMessage( 1010517 ); // You apply the poison

                            Misc.Titles.AwardKarma(m_From, -20, true);
                        }
                        else                         // Failed
                        {
                            // 5% of chance of getting poisoned if failed
                            if (m_From.Skills[SkillName.Poisoning].Base < 80.0 && Utility.Random(20) == 0)
                            {
                                m_From.SendLocalizedMessage(502148);                                   // You make a grave mistake while applying the poison.
                                m_From.ApplyPoison(m_From, m_Poison);
                            }
                            else
                            {
                                if (m_Target is Food || m_Target is BaseBeverage)
                                {
                                    m_From.SendLocalizedMessage(1010518);                                       // You fail to apply a sufficient dose of poison
                                }
                                else if (m_Target is BaseWeapon)
                                {
                                    BaseWeapon weapon = (BaseWeapon)m_Target;

                                    if (weapon.Type == WeaponType.Slashing)
                                    {
                                        m_From.SendLocalizedMessage(1010516);                                           // You fail to apply a sufficient dose of poison on the blade
                                    }
                                    else
                                    {
                                        m_From.SendLocalizedMessage(1010518);                                           // You fail to apply a sufficient dose of poison
                                    }
                                }
                                else if (m_Target is Cloth)
                                {
                                    m_From.SendMessage("You fail to apply a sufficient dose of poison to soak the rag.");
                                }
                            }
                        }
                        //pla: set 10 second delay before next skill use
                        m_From.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(10.0);
                    }
Esempio n. 36
0
            protected override void OnTarget( Mobile from, object targeted )
            {
                if ( m_Ore.Deleted )
                    return;

                if ( !from.InRange( m_Ore.GetWorldLocation(), 2 ) )
                    from.SendLocalizedMessage( 501976 ); // The ore is too far away.
                if ( targeted is BaseOre )
                {
                    BaseOre ore = (BaseOre)targeted;

                    if ( !ore.Movable )
                        return;

                    if ( m_Ore == ore )
                    {
                        from.SendLocalizedMessage( 501972 ); // Select another pile or ore with which to combine this.
                        from.Target = new InternalTarget( ore );
                    }
                    else if ( ore.Resource != m_Ore.Resource )
                        from.SendLocalizedMessage( 501979 ); // You cannot combine ores of different metals.
                    else
                    {
                        int worth = ore.Amount;

                        if ( ore.ItemID == 0x19B9 )
                            worth *= 8;
                        else if ( ore.ItemID == 0x19B7 )
                            worth *= 2;
                        else
                            worth *= 4;

                        int sourceWorth = m_Ore.Amount;

                        if ( m_Ore.ItemID == 0x19B9 )
                            sourceWorth *= 8;
                        else if ( m_Ore.ItemID == 0x19B7 )
                            sourceWorth *= 2;
                        else
                            sourceWorth *= 4;

                        worth += sourceWorth;

                        int plusWeight = 0;
                        int newID = ore.ItemID;

                        if ( ore.DefaultWeight != m_Ore.DefaultWeight )
                        {
                            if ( ore.ItemID == 0x19B7 || m_Ore.ItemID == 0x19B7 )
                                newID = 0x19B7;
                            else if ( ore.ItemID == 0x19B9 )
                            {
                                newID = m_Ore.ItemID;
                                plusWeight = ore.Amount * 2;
                            }
                            else
                                plusWeight = m_Ore.Amount * 2;
                        }

                        if ( (ore.ItemID == 0x19B9 && worth > 120000) || (( ore.ItemID == 0x19B8 || ore.ItemID == 0x19BA ) && worth > 60000) || (ore.ItemID == 0x19B7 && worth > 30000))
                            from.SendLocalizedMessage( 1062844 ); // There is too much ore to combine.
                        else if ( ore.RootParent is Mobile && (plusWeight + ((Mobile)ore.RootParent).Backpack.TotalWeight) > ((Mobile)ore.RootParent).Backpack.MaxWeight )
                            from.SendLocalizedMessage( 501978 ); // The weight is too great to combine in a container.
                        else
                        {
                            ore.ItemID = newID;
                            if ( ore.ItemID == 0x19B9 )
                            {
                                ore.Amount = worth / 8;
                                m_Ore.Delete();
                            }
                            else if ( ore.ItemID == 0x19B7 )
                            {
                                ore.Amount = worth / 2;
                                m_Ore.Delete();
                            }
                            else
                            {
                                ore.Amount = worth / 4;
                                m_Ore.Delete();
                            }
                        }
                    }
                }
                else if ( IsForge( targeted ) )
                {
                    double difficulty;

                    switch ( m_Ore.Resource )
                    {
                        default: difficulty = 50.0; break;
                        case CraftResource.DullCopper: difficulty = 65.0; break;
                        case CraftResource.ShadowIron: difficulty = 70.0; break;
                        case CraftResource.Copper: difficulty = 75.0; break;
                        case CraftResource.Bronze: difficulty = 80.0; break;
                        case CraftResource.Gold: difficulty = 85.0; break;
                        case CraftResource.Agapite: difficulty = 90.0; break;
                        case CraftResource.Verite: difficulty = 95.0; break;
                        case CraftResource.Valorite: difficulty = 99.0; break;
                    }

                    double minSkill = difficulty - 25.0;
                    double maxSkill = difficulty + 25.0;

                    if ( difficulty > 50.0 && difficulty > from.Skills[SkillName.Mining].Value )
                        from.SendLocalizedMessage( 501986 ); // You have no idea how to smelt this strange ore!
                    else if ( m_Ore.Amount <= 1 && m_Ore.ItemID == 0x19B7 )
                        from.SendLocalizedMessage( 501987 ); // There is not enough metal-bearing ore in this pile to make an ingot.
                    else if ( from.CheckTargetSkill( SkillName.Mining, targeted, minSkill, maxSkill ) )
                    {
                        if ( m_Ore.Amount <= 0 )
                            from.SendLocalizedMessage( 501987 ); // There is not enough metal-bearing ore in this pile to make an ingot.
                        else
                        {
                            int amount = m_Ore.Amount;
                            if ( m_Ore.Amount > 30000 )
                                amount = 30000;

                            BaseIngot ingot = m_Ore.GetIngot();

                            if ( m_Ore.ItemID == 0x19B7 )
                            {
                                amount /= 2;
                                if ( m_Ore.Amount % 2 == 0 )
                                    m_Ore.Delete();
                                else
                                    m_Ore.Amount = 1;
                            }
                            else if ( m_Ore.ItemID == 0x19B9 )
                            {
                                amount *= 2;
                                m_Ore.Delete();
                            }
                            else
                                m_Ore.Delete();

                            ingot.Amount = amount;
                            from.AddToBackpack( ingot );
                            //from.PlaySound( 0x57 );

                            from.SendLocalizedMessage( 501988 ); // You smelt the ore removing the impurities and put the metal in your backpack.
                        }
                    }
                    else if ( m_Ore.Amount < 2 && m_Ore.ItemID == 0x19B9 )
                    {
                        from.SendLocalizedMessage( 501990 ); // You burn away the impurities but are left with less useable metal.
                        m_Ore.ItemID = 0x19B8;
                    }
                    else if ( m_Ore.Amount < 2 && m_Ore.ItemID == 0x19B8 || m_Ore.ItemID == 0x19BA )
                    {
                        from.SendLocalizedMessage( 501990 ); // You burn away the impurities but are left with less useable metal.
                        m_Ore.ItemID = 0x19B7;
                    }
                    else
                    {
                        from.SendLocalizedMessage( 501990 ); // You burn away the impurities but are left with less useable metal.
                        m_Ore.Amount /= 2;
                    }
                }
            }
Esempio n. 37
0
            protected override void OnTarget(Mobile from, object target)
            {
                IEntity entity = target as IEntity; if (XmlScript.HasTrigger(entity, TriggerName.onTargeted) && UberScriptTriggers.Trigger(entity, from, TriggerName.onTargeted, null, null, null, 0, null, SkillName.Forensics, from.Skills[SkillName.Forensics].Value))

                {
                    return;
                }

                if (target is Mobile)
                {
                    if (from.CheckTargetSkill(SkillName.Forensics, target, 40.0, 100.0))
                    {
                        if (target is PlayerMobile && ((PlayerMobile)target).NpcGuild == NpcGuild.ThievesGuild)
                        {
                            from.SendLocalizedMessage(501004);                              //That individual is a thief!
                        }
                        else
                        {
                            from.SendLocalizedMessage(501003);                              //You notice nothing unusual.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(501001);                          //You cannot determain anything useful.
                    }
                }
                else if (target is Corpse)
                {
                    if (from.CheckTargetSkill(SkillName.Forensics, target, 0.0, 100.0))
                    {
                        Corpse c = (Corpse)target;

                        if (c.Forensicist != null)
                        {
                            from.SendLocalizedMessage(1042750, c.Forensicist);                                // The forensicist  ~1_NAME~ has already discovered that:
                        }
                        else
                        {
                            c.Forensicist = from.Name;
                        }

                        if (((Body)c.Amount).IsHuman)
                        {
                            from.SendLocalizedMessage(1042751, (c.Killer == null ? "no one" : c.Killer.Name));                                //This person was killed by ~1_KILLER_NAME~
                        }
                        if (c.Looters.Count > 0)
                        {
                            StringBuilder sb = new StringBuilder();
                            for (int i = 0; i < c.Looters.Count; i++)
                            {
                                if (i > 0)
                                {
                                    sb.Append(", ");
                                }
                                sb.Append(((Mobile)c.Looters[i]).Name);
                            }

                            from.SendLocalizedMessage(1042752, sb.ToString());                              //This body has been distrubed by ~1_PLAYER_NAMES~
                        }
                        else
                        {
                            from.SendLocalizedMessage(501002);                              //The corpse has not be desecrated.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(501001);                          //You cannot determain anything useful.
                    }
                }
                else if (target is ILockpickable)
                {
                    ILockpickable p = (ILockpickable)target;
                    if (p.Picker != null)
                    {
                        from.SendLocalizedMessage(1042749, p.Picker.Name);                          //This lock was opened by ~1_PICKER_NAME~
                    }
                    else
                    {
                        from.SendLocalizedMessage(501003);                          //You notice nothing unusual.
                    }
                }
            }
Esempio n. 38
0
            protected override void OnTarget( Mobile from, object targeted )
            {
                if ( targeted is Mobile )
                {
                    from.SendAsciiMessage("You feel that such an action would be inappropriate."); // You feel that such an action would be inappropriate
                }
                else if ( targeted is TrapableContainer )
                {
                    TrapableContainer targ = (TrapableContainer)targeted;

                    from.Direction = from.GetDirectionTo( targ );

                    if ( targ.TrapType == TrapType.None )
                    {
                        from.SendAsciiMessage("That doesn't appear to be trapped"); // That doesn't appear to be trapped
                        return;
                    }

                    from.PlaySound( 0x241 );

                    if ( from.CheckTargetSkill( SkillName.RemoveTrap, targ, targ.TrapPower, targ.TrapPower + 30 ) )
                    {
                        targ.TrapPower = 0;
                        targ.TrapLevel = 0;
                        targ.TrapType = TrapType.None;
                        from.SendAsciiMessage("You successfully render the trap harmless"); // You successfully render the trap harmless
                    }
                    else
                    {
                        from.SendAsciiMessage("You fail to disarm the trap... but you don't set it off."); // You fail to disarm the trap... but you don't set it off
                    }
                }
                else if ( targeted is BaseFactionTrap )
                {
                    BaseFactionTrap trap = (BaseFactionTrap) targeted;
                    Faction faction = Faction.Find( from );

                    FactionTrapRemovalKit kit = ( from.Backpack == null ? null : from.Backpack.FindItemByType( typeof( FactionTrapRemovalKit ) ) as FactionTrapRemovalKit );

                    bool isOwner = ( trap.Placer == from || ( trap.Faction != null && trap.Faction.IsCommander( from ) ) );

                    if ( faction == null )
                    {
                        from.SendLocalizedMessage( 1010538 ); // You may not disarm faction traps unless you are in an opposing faction
                    }
                    else if ( faction == trap.Faction && trap.Faction != null && !isOwner )
                    {
                        from.SendLocalizedMessage( 1010537 ); // You may not disarm traps set by your own faction!
                    }
                    else if ( !isOwner && kit == null )
                    {
                        from.SendLocalizedMessage( 1042530 ); // You must have a trap removal kit at the base level of your pack to disarm a faction trap.
                    }
                    else
                    {
                        if ( from.CheckTargetSkill( SkillName.RemoveTrap, trap, 80.0, 100.0 ) && from.CheckTargetSkill( SkillName.Tinkering, trap, 80.0, 100.0 ) )
                        {
                            from.PrivateOverheadMessage( MessageType.Regular, trap.MessageHue, trap.DisarmMessage, from.NetState );

                            if ( !isOwner )
                            {
                                int silver = faction.AwardSilver( from, trap.SilverFromDisarm );

                                if ( silver > 0 )
                                    from.SendLocalizedMessage( 1008113, true, silver.ToString( "N0" ) ); // You have been granted faction silver for removing the enemy trap :
                            }

                            trap.Delete();
                        }
                        else
                        {
                            from.SendLocalizedMessage( 502372 ); // You fail to disarm the trap... but you don't set it off
                        }

                        if ( !isOwner && kit != null )
                            kit.ConsumeCharge( from );
                    }
                }
                else
                {
                    from.SendAsciiMessage( "That doesn't appear to be trapped." ); // That does'nt appear to be trapped
                }
            }
Esempio n. 39
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                from.RevealingAction();

                if (targeted is BaseCreature)
                {
                    BaseCreature creature = (BaseCreature)targeted;

                    if (m_Creature.Unprovokable || creature.Unprovokable)
                    {
                        from.SendAsciiMessage("You have no chance of provoking those creatures.");
                    }
                    else if (m_Creature.Map != creature.Map || !m_Creature.InRange(creature, BaseInstrument.GetBardRange(from, SkillName.Provocation)))
                    {
                        from.SendAsciiMessage("The creatures you are trying to provoke are too far away from each other for your music to have an effect.");
                    }
                    else if (m_Creature != creature)
                    {
                        from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(10.0);

                        double diff  = ((m_Instrument.GetDifficultyFor(m_Creature) + m_Instrument.GetDifficultyFor(creature)) * 0.5) - 5.0;
                        double music = from.Skills[SkillName.Musicianship].Value;

                        if (music > 100.0)
                        {
                            diff -= (music - 100.0) * 0.5;
                        }

                        if (from.CanBeHarmful(m_Creature, true) && from.CanBeHarmful(creature, true))
                        {
                            if (!BaseInstrument.CheckMusicianship(from))
                            {
                                from.SendAsciiMessage("You play poorly, and there is no effect.");
                                m_Instrument.PlayInstrumentBadly(from);
                                m_Instrument.ConsumeUse(from);
                            }
                            else
                            {
                                from.DoHarmful(m_Creature);
                                from.DoHarmful(creature);

                                if (!from.CheckTargetSkill(SkillName.Provocation, creature, 0, 100))
                                {
                                    from.SendAsciiMessage("Your music fails to incite enough anger.");
                                    m_Instrument.PlayInstrumentBadly(from);
                                    m_Instrument.ConsumeUse(from);
                                }
                                else
                                {
                                    from.SendAsciiMessage("Your music succeeds, as you start a fight.");
                                    m_Instrument.PlayInstrumentWell(from);
                                    m_Instrument.ConsumeUse(from);
                                    m_Creature.Provoke(from, creature, true);
                                }
                            }
                        }
                    }
                    else
                    {
                        from.SendAsciiMessage("You can't tell someone to attack themselves!");
                    }
                }
            }
Esempio n. 40
0
            protected override void OnTarget(Mobile from, object target)
            {
                if (target is Mobile)
                {
                    if (from.CheckTargetSkill(SkillName.Forensics, target, 40.0, 100.0))
                    {
                        if (target is PlayerMobile && ((PlayerMobile)target).NpcGuild == NpcGuild.ThievesGuild)
                            from.SendLocalizedMessage(501004);//That individual is a thief!
                        else
                            from.SendLocalizedMessage(501003);//You notice nothing unusual.
                    }
                    else
                    {
                        from.SendLocalizedMessage(501001);//You cannot determain anything useful.
                    }
                }
                else if (target is Corpse)
                {
                    if (from.CheckTargetSkill(SkillName.Forensics, target, 0.0, 100.0))
                    {
                        Corpse c = (Corpse)target;

                        if (c.m_Forensicist != null)
                            from.SendLocalizedMessage(1042750, c.m_Forensicist) ; // The forensicist  ~1_NAME~ has already discovered that:
                        else
                            c.m_Forensicist = from.Name;

                        if (((Body)c.Amount).IsHuman)
                            from.SendLocalizedMessage(1042751, (c.Killer == null ? "no one" : c.Killer.Name));//This person was killed by ~1_KILLER_NAME~

                        if (c.Looters.Count > 0)
                        {
                            StringBuilder sb = new StringBuilder();
                            for (int i = 0; i < c.Looters.Count; i++)
                            {
                                if (i > 0)
                                    sb.Append(", ");
                                sb.Append(((Mobile)c.Looters[i]).Name);
                            }

                            from.SendLocalizedMessage(1042752, sb.ToString());//This body has been distrubed by ~1_PLAYER_NAMES~
                        }
                        else
                        {
                            from.SendLocalizedMessage(501002);//The corpse has not be desecrated.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(501001);//You cannot determain anything useful.
                    }
                }
                else if (target is ILockpickable)
                {
                    ILockpickable p = (ILockpickable)target;
                    if (p.Picker != null)
                        from.SendLocalizedMessage(1042749, p.Picker.Name);//This lock was opened by ~1_PICKER_NAME~
                    else
                        from.SendLocalizedMessage(501003);//You notice nothing unusual.
                }
            }
Esempio n. 41
0
        public virtual bool ExecuteTrap(Mobile from)
        {
            if (m_TrapType != TrapType.None)
            {
                Point3D loc   = this.GetWorldLocation();
                Map     facet = this.Map;

                if (from.AccessLevel >= AccessLevel.GameMaster)
                {
                    SendMessageTo(from, "That is trapped, but you open it with your godly powers.", 0x3B2);
                    return(false);
                }

                int nTrapLevel  = TrapLevel * 10;
                int nTrapLevel2 = nTrapLevel + 20;

                if ((int)(from.Skills[SkillName.RemoveTrap].Value) < nTrapLevel)
                {
                    from.CheckTargetSkill(SkillName.RemoveTrap, this, 0, nTrapLevel2);
                }
                else if (from.CheckTargetSkill(SkillName.RemoveTrap, this, 0, nTrapLevel2))
                {
                    from.PlaySound(0x241);
                    TrapPower = 0;
                    TrapLevel = 0;
                    TrapType  = TrapType.None;
                    SendMessageTo(from, "That was trapped, but you were able to disable it.", 0x3B2);
                    return(false);
                }

                if (from.Backpack != null)
                {
                    Item magicwand   = from.Backpack.FindItemByType(typeof(TrapWand));
                    Item tenfootpole = from.Backpack.FindItemByType(typeof(TenFootPole));

                    if (GetPlayerInfo.LuckyPlayer(from.Luck))
                    {
                        from.PlaySound(0x241);
                        TrapPower = 0;
                        TrapLevel = 0;
                        TrapType  = TrapType.None;
                        SendMessageTo(from, "That was trapped, but with luck on your side...it broke.", 0x3B2);
                        return(false);
                    }
                    if (magicwand != null)
                    {
                        TrapWand wands    = (TrapWand)magicwand;
                        int      nPower   = wands.WandPower;
                        int      nAgainst = Utility.RandomMinMax(nTrapLevel, nTrapLevel2);
                        if (nPower >= nAgainst)
                        {
                            from.PlaySound(0x1F0);
                            TrapPower = 0;
                            TrapLevel = 0;
                            TrapType  = TrapType.None;
                            SendMessageTo(from, "That was trapped, but your magic wand disabled it.", 0x3B2);
                            return(false);
                        }
                    }
                    if (tenfootpole != null)
                    {
                        TenFootPole poles = (TenFootPole)tenfootpole;
                        if (50 >= Utility.RandomMinMax(nTrapLevel, nTrapLevel2))
                        {
                            from.PlaySound(0x039);
                            TrapPower     = 0;
                            TrapLevel     = 0;
                            TrapType      = TrapType.None;
                            poles.Charges = poles.Charges - 1;
                            if (poles.Charges < 1)
                            {
                                SendMessageTo(from, "You tap your ten foot pole, disabling a trap and breaking the pole.", 0x3B2);
                                poles.Delete();
                            }
                            else
                            {
                                SendMessageTo(from, "You tap your ten foot pole, disabling a trap.", 0x3B2);
                                poles.InvalidateProperties();
                            }
                            return(false);
                        }
                    }
                }

                int MagicAvoid = (int)((from.Skills[SkillName.RemoveTrap].Value + from.EnergyResistance) / 3);
                if (MagicAvoid > 90)
                {
                    MagicAvoid = 90;
                }

                switch (m_TrapType)
                {
                case TrapType.ExplosionTrap:
                {
                    SendMessageTo(from, 502999, 0x3B2);                               // You set off a trap!

                    if (from.InRange(loc, 3))
                    {
                        int damage = Utility.RandomMinMax(50, 200);
                        damage = (int)((damage * (100 - from.FireResistance)) / 100);
                        AOS.Damage(from, damage, 0, 100, 0, 0, 0);

                        // Your skin blisters from the heat!
                        from.LocalOverheadMessage(Network.MessageType.Regular, 0x2A, 503000);
                    }

                    Effects.SendLocationEffect(loc, facet, 0x36BD, 15, 10);
                    Effects.PlaySound(loc, facet, 0x307);

                    break;
                }

                case TrapType.MagicTrap:
                {
                    if (from.InRange(loc, 1))
                    {
                        int damage = Utility.RandomMinMax(50, 200);
                        damage = (int)((damage * (100 - MagicAvoid)) / 100);
                        from.Damage(damage);
                    }

                    Effects.PlaySound(loc, Map, 0x307);

                    Effects.SendLocationEffect(new Point3D(loc.X - 1, loc.Y, loc.Z), Map, 0x36BD, 15);
                    Effects.SendLocationEffect(new Point3D(loc.X + 1, loc.Y, loc.Z), Map, 0x36BD, 15);

                    Effects.SendLocationEffect(new Point3D(loc.X, loc.Y - 1, loc.Z), Map, 0x36BD, 15);
                    Effects.SendLocationEffect(new Point3D(loc.X, loc.Y + 1, loc.Z), Map, 0x36BD, 15);

                    Effects.SendLocationEffect(new Point3D(loc.X + 1, loc.Y + 1, loc.Z + 11), Map, 0x36BD, 15);

                    break;
                }

                case TrapType.DartTrap:
                {
                    SendMessageTo(from, 502999, 0x3B2);                               // You set off a trap!

                    if (from.InRange(loc, 3))
                    {
                        int damage = Utility.RandomMinMax(50, 200);
                        damage = (int)((damage * (100 - from.PhysicalResistance)) / 100);
                        AOS.Damage(from, damage, 100, 0, 0, 0, 0);

                        // A dart imbeds itself in your flesh!
                        from.LocalOverheadMessage(Network.MessageType.Regular, 0x62, 502998);
                    }

                    Effects.PlaySound(loc, facet, 0x223);

                    break;
                }

                case TrapType.PoisonTrap:
                {
                    SendMessageTo(from, 502999, 0x3B2);                               // You set off a trap!

                    if (from.InRange(loc, 3))
                    {
                        Poison poison = Poison.Lesser;

                        int itHurts = from.PoisonResistance;
                        int itSicks = 0;

                        if (itHurts >= 70)
                        {
                            itSicks = 1;
                        }
                        else if (itHurts >= 50)
                        {
                            itSicks = 2;
                        }
                        else if (itHurts >= 30)
                        {
                            itSicks = 3;
                        }
                        else if (itHurts >= 10)
                        {
                            itSicks = 4;
                        }
                        else
                        {
                            itSicks = 5;
                        }

                        switch (Utility.RandomMinMax(1, itSicks))
                        {
                        case 1: poison = Poison.Lesser;         break;

                        case 2: poison = Poison.Regular;        break;

                        case 3: poison = Poison.Greater;        break;

                        case 4: poison = Poison.Deadly;         break;

                        case 5: poison = Poison.Lethal;         break;
                        }

                        from.ApplyPoison(from, poison);

                        // You are enveloped in a noxious green cloud!
                        from.LocalOverheadMessage(Network.MessageType.Regular, 0x44, 503004);
                    }

                    Effects.SendLocationEffect(loc, facet, 0x113A, 10, 20);
                    Effects.PlaySound(loc, facet, 0x231);

                    break;
                }
                }

                m_TrapType  = TrapType.None;
                m_TrapPower = 0;
                m_TrapLevel = 0;
                return(true);
            }

            return(false);
        }
Esempio n. 42
0
			protected override void OnTarget( Mobile from, object target )
			{
				from.RevealingAction();

				if ( !m_Instrument.IsChildOf( from.Backpack ) )
				{
					from.SendLocalizedMessage( 1062488 ); // The instrument you are trying to play is no longer in your backpack!
				}
				else if ( target is Mobile )
				{
					Mobile targ = (Mobile)target;

					if ( targ == from || (targ is BaseCreature && ( ((BaseCreature)targ).BardImmune || !from.CanBeHarmful( targ, false ) )) )
					{
						from.SendLocalizedMessage( 1049535 ); // A song of discord would have no effect on that.
					}
					else if ( !targ.Player )
					{
						TimeSpan len = TimeSpan.FromSeconds( from.Skills[SkillName.Discordance].Value * 2 );
						double diff = m_Instrument.GetDifficultyFor( targ ) - 10.0;
						double music = from.Skills[SkillName.Musicianship].Value;

						if ( music > 100.0 )
							diff -= (music - 100.0) * 0.5;

						if ( !BaseInstrument.CheckMusicianship( from ) )
						{
							from.SendLocalizedMessage( 500612 ); // You play poorly, and there is no effect.
							m_Instrument.PlayInstrumentBadly( from );
							m_Instrument.ConsumeUse( from );
						}
						else if ( from.CheckTargetSkill( SkillName.Discordance, target, diff-25.0, diff+25.0 ) )
						{
							if ( !m_Table.Contains( targ ) )
							{
								from.SendLocalizedMessage( 1049539 ); // You play the song surpressing your targets strength
								m_Instrument.PlayInstrumentWell( from );
								m_Instrument.ConsumeUse( from );

								ArrayList mods = new ArrayList();
								int effect;
								double scalar;

								if ( Core.AOS )
								{
									double discord = from.Skills[SkillName.Discordance].Value;

									if ( discord > 100.0 )
										effect = -20 + (int)((discord - 100.0) / -2.5);
									else
										effect = (int)(discord / -5.0);

									if ( Core.SE && BaseInstrument.GetBaseDifficulty( targ ) >= 160.0 )
										effect /= 2;

									scalar = effect * 0.01;

									mods.Add( new ResistanceMod( ResistanceType.Physical, effect ) );
									mods.Add( new ResistanceMod( ResistanceType.Fire, effect ) );
									mods.Add( new ResistanceMod( ResistanceType.Cold, effect ) );
									mods.Add( new ResistanceMod( ResistanceType.Poison, effect ) );
									mods.Add( new ResistanceMod( ResistanceType.Energy, effect ) );

									for ( int i = 0; i < targ.Skills.Length; ++i )
									{
										if ( targ.Skills[i].Value > 0 )
											mods.Add( new DefaultSkillMod( (SkillName)i, true, targ.Skills[i].Value * scalar ) );
									}
								}
								else
								{
									effect = (int)( from.Skills[SkillName.Discordance].Value / -5.0 );
									scalar = effect * 0.01;

									mods.Add( new StatMod( StatType.Str, "DiscordanceStr", (int)(targ.RawStr * scalar), TimeSpan.Zero ) );
									mods.Add( new StatMod( StatType.Int, "DiscordanceInt", (int)(targ.RawInt * scalar), TimeSpan.Zero ) );
									mods.Add( new StatMod( StatType.Dex, "DiscordanceDex", (int)(targ.RawDex * scalar), TimeSpan.Zero ) );

									for ( int i = 0; i < targ.Skills.Length; ++i )
									{
										if ( targ.Skills[i].Value > 0 )
											mods.Add( new DefaultSkillMod( (SkillName)i, true, targ.Skills[i].Value * scalar ) );
									}
								}

								DiscordanceInfo info = new DiscordanceInfo( from, targ, len, Math.Abs( effect ), mods );
								info.m_Timer = Timer.DelayCall( TimeSpan.Zero, TimeSpan.FromSeconds( 1.25 ), new TimerStateCallback( ProcessDiscordance ), info );

								m_Table[targ] = info;
							}
							else
							{
								from.SendLocalizedMessage( 1049537 );// Your target is already in discord.
							}
						}
						else
						{
							from.SendLocalizedMessage( 1049540 );// You fail to disrupt your target
							m_Instrument.PlayInstrumentBadly( from );
							m_Instrument.ConsumeUse( from );
						}
					}
					else
					{
						m_Instrument.PlayInstrumentBadly( from );
					}
				}
				else
				{
					from.SendLocalizedMessage( 1049535 ); // A song of discord would have no effect on that.
				}
			}
Esempio n. 43
0
                protected override void OnTick()
                {
                    bool orcs   = IsOrc(m_Target);
                    bool savage = IsSavage(m_Target);

                    var badKarmaChance  = 0.5 - ((double)m_From.Karma / 8570);         //Lower your Karma Less chance you get
                    var goodKarmaChance = 0.5 + ((double)m_From.Karma / 8570);         //Higher Karma less chance for Monsters

                    m_From.NextSkillTime = Core.TickCount + 10000;                     //Set next skill use 10 seconds
                    if (!orcs && !savage && m_From.Karma < 0 && badKarmaChance > Utility.RandomDouble())
                    {
                        if (!orcs && m_From.CheckTargetSkill(SkillName.Begging, m_Target, 0, 100))
                        {
                            m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500406);
                        }
                        else
                        {
                            m_Target.PublicOverheadMessage(MessageType.Regular, m_Target.SpeechHue, 500406);
                        }
                        // Thou dost not look trustworthy... no gold for thee today!
                    }
                    else if (orcs)
                    {
                        if (m_From.Karma > 0 && goodKarmaChance > Utility.RandomDouble())
                        {
                            m_From.SendMessage("You seem to notable to beg");
                        }
                        else
                        {
                            //Console.WriteLine("Orc Begged");
                            if (m_From.CheckTargetSkill(SkillName.Begging, m_Target, 80, 100)) //Need 80+ Skill to Attempt to Beg Orc
                            {
                                int begchance = Utility.Random(100);                           //Lets see if you have bad accident
                                if (begchance <= 10)                                           //10% chance to blow up mask
                                {
                                    Item item = m_From.FindItemOnLayer(Layer.Helm);

                                    if (item is OrcishKinMask)
                                    {
                                        m_From.SendMessage("{0} alerts the other orcs that you are a fake", m_Target);                                         //Orcs dont beg
                                        AOS.Damage(m_From, 50, 0, 100, 0, 0, 0);
                                        item.Delete();
                                        m_From.FixedParticles(0x36BD, 20, 10, 5044, EffectLayer.Head);
                                        m_From.PlaySound(0x307);
                                    }
                                }
                                else if (begchance <= 30)                                 //30% to just attack player
                                {
                                    m_Target.Attack(m_From);
                                    m_From.SendMessage("{0} seems upset", m_Target);                                     //Well they dont like beggers
                                }
                                else
                                {
                                    BegChance(m_From, m_Target, true, false);                                     //What is your chance to beg?
                                }
                            }
                            else
                            {
                                m_From.SendMessage("They don't seem to have noticed you");
                            }
                        }
                    }
                    else if (savage)
                    {
                        //Console.WriteLine("Savage Beg");
                        if (m_From.CheckTargetSkill(SkillName.Begging, m_Target, 80, 100))                         //Need 80+ Skill to Attempt to beg from Savages
                        {
                            int begchance = Utility.Random(100);
                            if (begchance <= 10)                             //10% chance to blow up paint, Pride Tribesman/Women!
                            {
                                if (m_From.BodyMod == 183 || m_From.BodyMod == 184)
                                {
                                    AOS.Damage(m_From, 50, 0, 100, 0, 0, 0);
                                    m_From.BodyMod = 0;
                                    m_From.HueMod  = -1;
                                    m_From.FixedParticles(0x36BD, 20, 10, 5044, EffectLayer.Head);
                                    m_From.PlaySound(0x307);
                                    m_From.SendLocalizedMessage(1040008);                                     // Your skin is scorched as the tribal paint burns away!
                                    ((PlayerMobile)m_From).SavagePaintExpiration = TimeSpan.Zero;
                                }
                            }
                            else if (begchance <= 30)                             //30% to just attack player
                            {
                                m_Target.Attack(m_From);
                                m_From.SendMessage("{0} seems upset", m_Target);
                            }
                            else
                            {
                                BegChance(m_From, m_Target, false, true);                                 //Whats your Beg Chance?
                            }
                        }
                    }
                    else if (m_From.CheckTargetSkill(SkillName.Begging, m_Target, 0, 100))
                    {
                        //Console.WriteLine("Human Beg");
                        BegChance(m_From, m_Target, false, false);                         //Not a Savage or Orc? Human than!
                    }
                    else
                    {
                        //Console.WriteLine("Fail Beg");
                        m_Target.SendLocalizedMessage(500404);                         // They seem unwilling to give you any money.
                    }
                }
Esempio n. 44
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (from == targeted)
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500324); // You know yourself quite well enough already.
                }
                else if (targeted is TownCrier)
                {
                    ((TownCrier)targeted).PrivateOverheadMessage(MessageType.Regular, 0x3B2, 500322, from.NetState); // This person looks fine to me, though he may have some news...
                }
                else if (targeted is BaseVendor && ((BaseVendor)targeted).IsInvulnerable)
                {
                    ((BaseVendor)targeted).PrivateOverheadMessage(MessageType.Regular, 0x3B2, 500326, from.NetState); // That can not be inspected.
                }
                else if (targeted is Mobile)
                {
                    Mobile targ = (Mobile)targeted;

                    int marginOfError = Math.Max(0, 25 - (int)(from.Skills[SkillName.Anatomy].Value / 4));

                    int str = targ.Str + Utility.RandomMinMax(-marginOfError, +marginOfError);
                    int dex = targ.Dex + Utility.RandomMinMax(-marginOfError, +marginOfError);
                    int stm = ((targ.Stam * 100) / Math.Max(targ.StamMax, 1)) + Utility.RandomMinMax(-marginOfError, +marginOfError);

                    int strMod = str / 10;
                    int dexMod = dex / 10;
                    int stmMod = stm / 10;

                    if (strMod < 0)
                    {
                        strMod = 0;
                    }
                    else if (strMod > 10)
                    {
                        strMod = 10;
                    }

                    if (dexMod < 0)
                    {
                        dexMod = 0;
                    }
                    else if (dexMod > 10)
                    {
                        dexMod = 10;
                    }

                    if (stmMod > 10)
                    {
                        stmMod = 10;
                    }
                    else if (stmMod < 0)
                    {
                        stmMod = 0;
                    }

                    if (from.CheckTargetSkill(SkillName.Anatomy, targ, 0, 100))
                    {
                        targ.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1038045 + (strMod * 11) + dexMod, from.NetState); // That looks [strong] and [dexterous].

                        if (from.Skills[SkillName.Anatomy].Base >= 65.0)
                        {
                            targ.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1038303 + stmMod, from.NetState); // That being is at [10,20,...] percent endurance.
                        }
                    }
                    else
                    {
                        targ.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1042666, from.NetState); // You can not quite get a sense of their physical characteristics.
                    }
                }
                else if (targeted is Item)
                {
                    ((Item)targeted).SendLocalizedMessageTo(from, 500323, ""); // Only living things have anatomies!
                }
            }
Esempio n. 45
0
				protected override void OnTarget( Mobile from, object targ )
				{
					if ( targ is IPoint2D )
					{
						if ( from.CheckTargetSkill( SkillName.Herding, m_Creature, 0, 100 ) )
						{
							m_Creature.TargetLocation = new Point2D( (IPoint2D)targ );
							from.SendLocalizedMessage( 502479 ); // The animal walks where it was instructed to.
						}
						else
						{
							from.SendLocalizedMessage( 502472 ); // You don't seem to be able to persuade that to move.
						}
					}
				}
Esempio n. 46
0
            protected override void OnTarget(Mobile from, object o)
            {
                Item   item = o as Item;
                Mobile m    = o as Mobile;

                if (item == null && m == null)
                {
                    from.SendLocalizedMessage(500353); // You are not certain...
                    return;
                }

                if (!from.CheckTargetSkill(SkillName.ItemID, o, 0, 100))
                {
                    from.PrivateOverheadMessage(MessageType.Emote, 0x3B2, 1041352, from.NetState); // You have no idea how much it might be worth.
                    return;
                }

                if (m != null)
                {
                    from.PrivateOverheadMessage(MessageType.Emote, 0x3B2, 1041349, AffixType.Append, "  " + m.Name, "", from.NetState); // It appears to be:
                    return;
                }

                if (item.Name != null)
                {
                    from.PrivateOverheadMessage(MessageType.Emote, 0x3B2, false, item.Name, from.NetState);
                    item.PrivateOverheadMessage(MessageType.Label, 0x3B2, false, item.Name, from.NetState);
                }
                else
                {
                    from.PrivateOverheadMessage(MessageType.Emote, 0x3B2, item.LabelNumber, from.NetState);
                    item.PrivateOverheadMessage(MessageType.Label, 0x3B2, item.LabelNumber, from.NetState);
                }

                if (item is Meteorite)
                {
                    if (((Meteorite)item).Polished)
                    {
                        from.SendLocalizedMessage(1158697); // The brilliance of the meteorite shimmers in the light as you rotate it in your hands! Brightly hued veins of exotic minerals reflect against the polished surface. You think to yourself you have never seen anything so full of splendor!
                    }
                    else
                    {
                        from.SendLocalizedMessage(1158696); // The rock seems to be otherwordly. Judging by the pitting and charring, it appears to have crash landed here from the sky! The rock feels surprisingly dense given its size. Perhaps if you polished it with an oil cloth you may discover what is inside...
                    }

                    return;
                }

                from.PrivateOverheadMessage(MessageType.Emote, 0x3B2, 1041351, AffixType.Append, "  " + GetPriceFor(item).ToString(), "", from.NetState); // You guess the value of that item at:

                if (item is BaseWeapon || item is BaseArmor || item is BaseJewel || item is BaseHat)
                {
                    if (Imbuing.TimesImbued(item) > 0)
                    {
                        from.PrivateOverheadMessage(MessageType.Emote, 0x3B2, 1111877, from.NetState); // You conclude that item cannot be magically unraveled. The magic in that item has been weakened due to either low durability or the imbuing process.
                    }
                    else
                    {
                        int    weight    = Imbuing.GetTotalWeight(item, -1, false, true);
                        string imbIngred = null;
                        double skill     = from.Skills[SkillName.Imbuing].Base;
                        bool   badSkill  = false;

                        if (!Imbuing.CanUnravelItem(from, item, false))
                        {
                            weight = 0;
                        }

                        if (weight > 0 && weight <= 200)
                        {
                            imbIngred = "Magical Residue";
                        }
                        else if (weight > 200 && weight < 480)
                        {
                            imbIngred = "Enchanted Essence";

                            if (skill < 45.0)
                            {
                                badSkill = true;
                            }
                        }
                        else if (weight >= 480)
                        {
                            imbIngred = "Relic Fragment";

                            if (skill < 95.0)
                            {
                                badSkill = true;
                            }
                        }

                        if (imbIngred != null)
                        {
                            if (badSkill)
                            {
                                from.PrivateOverheadMessage(MessageType.Emote, 0x3B2, 1111875, from.NetState); // Your Imbuing skill is not high enough to identify the imbuing ingredient.
                            }
                            else
                            {
                                from.PrivateOverheadMessage(MessageType.Emote, 0x3B2, 1111874, imbIngred, from.NetState); //You conclude that item will magically unravel into: ~1_ingredient~
                            }
                        }
                        else  // Cannot be Unravelled
                        {
                            from.PrivateOverheadMessage(MessageType.Emote, 0x3B2, 1111876, from.NetState); //You conclude that item cannot be magically unraveled. It appears to possess little to no magic.
                        }
                    }
                }
                else
                {
                    from.LocalOverheadMessage(MessageType.Emote, 0x3B2, 1111878); //You conclude that item cannot be magically unraveled.
                }

                Server.Engines.XmlSpawner2.XmlAttach.RevealAttachments(from, o);
            }
Esempio n. 47
0
            protected override void OnTarget( Mobile from, object targeted )
            {
                if ( targeted is BaseWeapon )
                {
                    if ( from.CheckTargetSkill( SkillName.Craftsmanship, targeted, 0, 100 ) )
                    {
                        BaseWeapon weap = (BaseWeapon)targeted;

                        if ( weap.MaxHitPoints != 0 )
                        {
                            int hp = (int)((weap.HitPoints / (double)weap.MaxHitPoints) * 10);

                            if ( hp < 0 )
                                hp = 0;
                            else if ( hp > 9 )
                                hp = 9;

                            from.SendLocalizedMessage( 1038285 + hp );
                        }

                        int damage = (weap.MaxDamage + weap.MinDamage) / 2;
                        int hand = (weap.Layer == Layer.OneHanded ? 0 : 1);

                        if ( damage < 3 )
                            damage = 0;
                        else
                            damage = (int)Math.Ceiling( Math.Min( damage, 30 ) / 5.0 );
                            /*
                        else if ( damage < 6 )
                            damage = 1;
                        else if ( damage < 11 )
                            damage = 2;
                        else if ( damage < 16 )
                            damage = 3;
                        else if ( damage < 21 )
                            damage = 4;
                        else if ( damage < 26 )
                            damage = 5;
                        else
                            damage = 6;
                             * */

                        WeaponType type = weap.Type;

                        if ( type == WeaponType.Ranged )
                            from.SendLocalizedMessage( 1038224 + (damage * 9) );
                        else if ( type == WeaponType.Piercing )
                            from.SendLocalizedMessage( 1038218 + hand + (damage * 9) );
                        else if ( type == WeaponType.Slashing )
                            from.SendLocalizedMessage( 1038220 + hand + (damage * 9) );
                        else if ( type == WeaponType.Bashing )
                            from.SendLocalizedMessage( 1038222 + hand + (damage * 9) );
                        else
                            from.SendLocalizedMessage( 1038216 + hand + (damage * 9) );

                        if ( weap.Poison != null && weap.PoisonCharges > 0 )
                            from.SendLocalizedMessage( 1038284 ); // It appears to have poison smeared on it.
                    }
                    else
                    {
                        from.SendLocalizedMessage( 500353 ); // You are not certain...
                    }
                }
                else if(targeted is BaseArmor)
                {
                    if( from.CheckTargetSkill(SkillName.Craftsmanship, targeted, 0, 100) )
                    {
                        BaseArmor arm = (BaseArmor)targeted;

                        if ( arm.MaxHitPoints != 0 )
                        {
                            int hp = (int)((arm.HitPoints / (double)arm.MaxHitPoints) * 10);

                            if ( hp < 0 )
                                hp = 0;
                            else if ( hp > 9 )
                                hp = 9;

                            from.SendLocalizedMessage( 1038285 + hp );
                        }

                        from.SendLocalizedMessage( 1038295 + (int)Math.Ceiling( Math.Min( arm.ArmorRating, 35 ) / 5.0 ) );
                        /*
                        if ( arm.ArmorRating < 1 )
                            from.SendLocalizedMessage( 1038295 ); // This armor offers no defense against attackers.
                        else if ( arm.ArmorRating < 6 )
                            from.SendLocalizedMessage( 1038296 ); // This armor provides almost no protection.
                        else if ( arm.ArmorRating < 11 )
                            from.SendLocalizedMessage( 1038297 ); // This armor provides very little protection.
                        else if ( arm.ArmorRating < 16 )
                            from.SendLocalizedMessage( 1038298 ); // This armor offers some protection against blows.
                        else if ( arm.ArmorRating < 21 )
                            from.SendLocalizedMessage( 1038299 ); // This armor serves as sturdy protection.
                        else if ( arm.ArmorRating < 26 )
                            from.SendLocalizedMessage( 1038300 ); // This armor is a superior defense against attack.
                        else if ( arm.ArmorRating < 31 )
                            from.SendLocalizedMessage( 1038301 ); // This armor offers excellent protection.
                        else
                            from.SendLocalizedMessage( 1038302 ); // This armor is superbly crafted to provide maximum protection.
                         * */
                    }
                    else
                    {
                        from.SendLocalizedMessage( 500353 ); // You are not certain...
                    }
                }
                else
                {
                    from.SendLocalizedMessage( 500352 ); // This is neither weapon nor armor.
                }
            }
Esempio n. 48
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                from.RevealingAction();

                if (targeted is BaseCreature)
                {
                    BaseCreature creature = (BaseCreature)targeted;

                    if (!m_Instrument.IsChildOf(from.Backpack))
                    {
                        from.SendLocalizedMessage(1062488);                           // The instrument you are trying to play is no longer in your backpack!
                    }
                    else if (m_Creature.UnprovokableTarget)
                    {
                        from.SendLocalizedMessage(1049446);                           // You have no chance of provoking those creatures.
                    }
                    else if (m_Creature.Map != creature.Map || !m_Creature.InRange(creature, BaseInstrument.GetBardRange(from, SkillName.Provocation)))
                    {
                        from.SendLocalizedMessage(1049450);                           // The creatures you are trying to provoke are too far away from each other for your music to have an effect.
                    }
                    else if (m_Creature != creature)
                    {
                        from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(7.0);

                        double diff  = ((m_Instrument.GetDifficultyFor(m_Creature) + m_Instrument.GetDifficultyFor(creature)) * 0.35) - 5.0;
                        double music = from.Skills[SkillName.Musicianship].Value;

                        if (music > 100.0)
                        {
                            diff -= (music - 100.0) * 0.5;
                        }

                        if (from.CanBeHarmful(m_Creature, true) && from.CanBeHarmful(creature, true))
                        {
                            if (!BaseInstrument.CheckMusicianship(from))
                            {
                                from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(5.0);
                                from.SendLocalizedMessage(500612);                                   // You play poorly, and there is no effect.
                                m_Instrument.PlayInstrumentBadly(from);
                                m_Instrument.ConsumeUse(from);
                            }
                            else
                            {
                                from.DoHarmful(m_Creature);
                                from.DoHarmful(creature);

                                if (!from.CheckTargetSkill(SkillName.Provocation, creature, diff - 25.0, diff + 25.0))
                                {
                                    from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(5.0);
                                    from.SendLocalizedMessage(501599);                                       // Your music fails to incite enough anger.
                                    m_Instrument.PlayInstrumentBadly(from);
                                    m_Instrument.ConsumeUse(from);
                                }
                                else
                                {
                                    from.SendLocalizedMessage(501602);                                       // Your music succeeds, as you start a fight.
                                    m_Instrument.PlayInstrumentWell(from);
                                    m_Instrument.ConsumeUse(from);
                                    m_Creature.Provoke(from, creature, true);
                                }
                            }
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(501593);                           // You can't tell someone to attack themselves!
                    }
                }
                else
                {
                    from.SendLocalizedMessage(501589);                       // You can't incite that!
                }
            }
Esempio n. 49
0
            protected override void OnTarget( Mobile src, object targ )
            {
                bool foundAnyone = false;

                Point3D p;
                if ( targ is Mobile )
                    p = ((Mobile)targ).Location;
                else if ( targ is Item )
                    p = ((Item)targ).Location;
                else if ( targ is IPoint3D )
                    p = new Point3D( (IPoint3D)targ );
                else
                    p = src.Location;

                double srcSkill = src.Skills[SkillName.DetectHidden].Value;
                int range = (int)(srcSkill / 10.0);

                if ( !src.CheckSkill( SkillName.DetectHidden, 0.0, 100.0 ) )
                    range /= 2;

                BaseHouse house = BaseHouse.FindHouseAt( p, src.Map, 16 );

                bool inHouse = ( house != null && house.IsFriend( src ) );

                if ( inHouse )
                    range = 22;

                if ( range > 0 )
                {
                    IPooledEnumerable inRange = src.Map.GetMobilesInRange( p, range );

                    foreach ( Mobile trg in inRange )
                    {
                        if ( trg.Hidden && src != trg )
                        {
                            double ss = srcSkill + Utility.Random( 21 ) - 10;
                            double ts = trg.Skills[SkillName.Hiding].Value + Utility.Random( 21 ) - 10;

                            if ( src.AccessLevel >= trg.AccessLevel && ( ss >= ts || ( inHouse && house.IsInside( trg ) ) ) )
                            {
                                /*if ( trg is ShadowKnight && (trg.X != p.X || trg.Y != p.Y) )
                                    continue;*/

                                trg.RevealingAction();
                                trg.SendLocalizedMessage( 500814 ); // You have been revealed!
                                foundAnyone = true;
                            }
                        }
                    }

                    inRange.Free();

                    if ( Faction.Find( src ) != null )
                    {
                        IPooledEnumerable itemsInRange = src.Map.GetItemsInRange( p, range );

                        foreach ( Item item in itemsInRange )
                        {
                            if ( item is BaseFactionTrap )
                            {
                                BaseFactionTrap trap = (BaseFactionTrap) item;

                                if ( src.CheckTargetSkill( SkillName.DetectHidden, trap, 80.0, 100.0 ) )
                                {
                                    src.SendLocalizedMessage( 1042712, true, " " + (trap.Faction == null ? "" : trap.Faction.Definition.FriendlyName) ); // You reveal a trap placed by a faction:

                                    trap.Visible = true;
                                    trap.BeginConceal();

                                    foundAnyone = true;
                                }
                            }
                        }

                        itemsInRange.Free();
                    }
                }

                if ( !foundAnyone )
                {
                    src.SendLocalizedMessage( 500817 ); // You can see nothing hidden there.
                }
            }
Esempio n. 50
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is Mobile)
                {
                    from.SendLocalizedMessage(502816);                       // You feel that such an action would be inappropriate
                }
                else if (targeted is TrapableContainer)
                {
                    if (from.Skills[SkillName.Lockpicking].Value < 50)
                    {
                        from.SendLocalizedMessage(502366);                           // You do not know enough about locks.  Become better at picking locks.
                        return;
                    }
                    else if (from.Skills[SkillName.DetectHidden].Value < 50)
                    {
                        from.SendLocalizedMessage(502367);                           // You are not perceptive enough.  Become better at detect hidden.
                        return;
                    }

                    TrapableContainer targ = (TrapableContainer)targeted;

                    from.Direction = from.GetDirectionTo(targ);

                    if (targ.TrapType == TrapType.None)
                    {
                        from.SendLocalizedMessage(502373);                           // That doesn't appear to be trapped
                        return;
                    }

                    from.PlaySound(0x241);

                    int minskill;
                    int maxskill;
                    LockableContainer lc = targ as LockableContainer;
                    if (lc != null && (targ.TrapType == TrapType.ExplosionTrap || targ.TrapType == TrapType.PoisonTrap))
                    {
                        // values used for tinkertraps
                        maxskill = targ.TrapPower;
                        minskill = (int)(targ.TrapPower * 0.8);
                    }
                    else                     // original values
                    {
                        maxskill = targ.TrapPower + 30;
                        minskill = targ.TrapPower;
                    }

                    if (from.CheckTargetSkill(SkillName.RemoveTrap, targ, minskill, maxskill))
                    {
                        targ.TrapPower = 0;
                        targ.TrapLevel = 0;
                        targ.TrapType  = TrapType.None;
                        from.SendLocalizedMessage(502377);                           // You successfully render the trap harmless
                    }
                    else
                    {
                        from.SendLocalizedMessage(502372);                           // You fail to disarm the trap... but you don't set it off
                    }
                }
                else if (targeted is BaseFactionTrap)
                {
                    BaseFactionTrap trap    = (BaseFactionTrap)targeted;
                    Faction         faction = Faction.Find(from);

                    FactionTrapRemovalKit kit = (from.Backpack == null ? null : from.Backpack.FindItemByType(typeof(FactionTrapRemovalKit)) as FactionTrapRemovalKit);

                    bool commander = trap.Faction != null && trap.Faction.IsCommander(from);

                    bool isOwner = (trap.Placer == from || commander);


                    if (!commander && from.Skills[SkillName.Lockpicking].Value < 50)
                    {
                        from.SendLocalizedMessage(502366);                           // You do not know enough about locks.  Become better at picking locks.
                    }
                    else if (!commander && from.Skills[SkillName.DetectHidden].Value < 50)
                    {
                        from.SendLocalizedMessage(502367);                           // You are not perceptive enough.  Become better at detect hidden.
                    }
                    else if (faction == null)
                    {
                        from.SendLocalizedMessage(1010538);                           // You may not disarm faction traps unless you are in an opposing faction
                    }
                    else if (faction == trap.Faction /*&& trap.Faction != null*/ && !isOwner)
                    {
                        from.SendLocalizedMessage(1010537);                           // You may not disarm traps set by your own faction!
                    }
                    else if (trap.Faction != null && kit == null)
                    {
                        from.SendLocalizedMessage(1042530);                           // You must have a trap removal kit at the base level of your pack to disarm a faction trap.
                    }
                    else
                    {
                        if (from.CheckTargetSkill(SkillName.RemoveTrap, trap, 80.0, 100.0) || commander)
                        {
                            from.PrivateOverheadMessage(MessageType.Regular, trap.MessageHue, trap.DisarmMessage, from.NetState);

                            if (!isOwner)
                            {
                                int silver = faction.AwardSilver(from, trap.SilverFromDisarm);

                                if (silver > 0)
                                {
                                    from.SendLocalizedMessage(1008113, true, silver.ToString("N0"));                                         // You have been granted faction silver for removing the enemy trap :
                                }
                            }

                            trap.Delete();
                        }
                        else
                        {
                            from.SendLocalizedMessage(502372);                               // You fail to disarm the trap... but you don't set it off
                        }
                        if (!isOwner && kit != null)
                        {
                            kit.ConsumeCharge(from);
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502373);                       // That doesn't appear to be trapped
                }
            }
Esempio n. 51
0
            protected override void OnTarget( Mobile from, object targeted )
            {
                if ( m_Ore.Deleted )
                    return;

                if ( !from.InRange( m_Ore.GetWorldLocation(), 2 ) )
                {
                    from.SendLocalizedMessage( 501976 ); // The ore is too far away.
                    return;
                }

                if ( IsForge( targeted ) )
                {
                    double difficulty;

                    switch ( m_Ore.Resource )
                    {
                        default: difficulty = 50.0; break;
                        case CraftResource.DullCopper: difficulty = 65.0; break;
                        case CraftResource.ShadowIron: difficulty = 70.0; break;
                        case CraftResource.Copper: difficulty = 75.0; break;
                        case CraftResource.Bronze: difficulty = 80.0; break;
                        case CraftResource.Gold: difficulty = 85.0; break;
                        case CraftResource.Agapite: difficulty = 90.0; break;
                        case CraftResource.Verite: difficulty = 95.0; break;
                        case CraftResource.Valorite: difficulty = 99.0; break;
                    }

                    double minSkill = difficulty - 25.0;
                    double maxSkill = difficulty + 25.0;

                    if ( difficulty > 50.0 && difficulty > from.Skills[SkillName.Mining].Value )
                    {
                        from.SendLocalizedMessage( 501986 ); // You have no idea how to smelt this strange ore!
                        return;
                    }

                    if ( from.CheckTargetSkill( SkillName.Mining, targeted, minSkill, maxSkill ) )
                    {
                        int toConsume = m_Ore.Amount;

                        if ( toConsume <= 0 )
                        {
                            from.SendLocalizedMessage( 501987 ); // There is not enough metal-bearing ore in this pile to make an ingot.
                        }
                        else
                        {
                            if ( toConsume > 30000 )
                                toConsume = 30000;

                            BaseIngot ingot = m_Ore.GetIngot();
                            ingot.Amount = toConsume * 2;

                            m_Ore.Consume( toConsume );
                            from.AddToBackpack( ingot );
                            //from.PlaySound( 0x57 );

                            from.SendLocalizedMessage( 501988 ); // You smelt the ore removing the impurities and put the metal in your backpack.
                        }
                    }
                    else if ( m_Ore.Amount < 2 )
                    {
                        from.SendLocalizedMessage( 501989 ); // You burn away the impurities but are left with no useable metal.
                        m_Ore.Delete();
                    }
                    else
                    {
                        from.SendLocalizedMessage( 501990 ); // You burn away the impurities but are left with less useable metal.
                        m_Ore.Amount /= 2;
                    }
                }
            }
Esempio n. 52
0
            protected override void OnTarget(Mobile from, object target)
            {
                from.RevealingAction();
                from.NextSkillTime = Core.TickCount + 1000;

                if (!m_Instrument.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1062488);                     // The instrument you are trying to play is no longer in your backpack!
                }
                else if (target is Mobile)
                {
                    Mobile targ = (Mobile)target;

                    if (targ == from ||
                        (targ is BaseCreature && (((BaseCreature)targ).BardImmune || !from.CanBeHarmful(targ, false)) &&
                         ((BaseCreature)targ).ControlMaster != from))
                    {
                        from.SendLocalizedMessage(1049535);              // A song of discord would have no effect on that.
                    }
                    else if (m_Table.Contains(targ))                     //Already discorded
                    {
                        from.SendLocalizedMessage(1049537);              // Your target is already in discord.
                    }
                    else if (!targ.Player || (from is BaseCreature) && ((BaseCreature)from).CanDiscord)
                    {
                        double diff         = m_Instrument.GetDifficultyFor(targ) - 10.0;
                        double music        = from.Skills[SkillName.Musicianship].Value;
                        int    masteryBonus = 0;

                        diff += XmlMobFactions.GetScaledFaction(from, targ, -25, 25, -0.001);

                        if (music > 100.0)
                        {
                            diff -= (music - 100.0) * 0.5;
                        }

                        if (from is PlayerMobile)
                        {
                            masteryBonus = Spells.SkillMasteries.BardSpell.GetMasteryBonus((PlayerMobile)from, SkillName.Discordance);
                        }

                        if (masteryBonus > 0)
                        {
                            diff -= (diff * ((double)masteryBonus / 100));
                        }

                        if (!BaseInstrument.CheckMusicianship(from))
                        {
                            from.SendLocalizedMessage(500612);                             // You play poorly, and there is no effect.
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);
                        }
                        else if (from.CheckTargetSkill(SkillName.Discordance, target, diff - 25.0, diff + 25.0))
                        {
                            from.SendLocalizedMessage(1049539);                             // You play the song surpressing your targets strength
                            m_Instrument.PlayInstrumentWell(from);
                            m_Instrument.ConsumeUse(from);

                            ArrayList mods = new ArrayList();
                            int       effect;
                            double    scalar;

                            if (Core.AOS)
                            {
                                double discord = from.Skills[SkillName.Discordance].Value;

                                if (discord > 100.0)
                                {
                                    effect = -20 + (int)((discord - 100.0) / -2.5);
                                }
                                else
                                {
                                    effect = (int)(discord / -5.0);
                                }

                                if (Core.SE && BaseInstrument.GetBaseDifficulty(targ) >= 160.0)
                                {
                                    effect /= 2;
                                }

                                scalar = effect * 0.01;

                                mods.Add(new ResistanceMod(ResistanceType.Physical, effect));
                                mods.Add(new ResistanceMod(ResistanceType.Fire, effect));
                                mods.Add(new ResistanceMod(ResistanceType.Cold, effect));
                                mods.Add(new ResistanceMod(ResistanceType.Poison, effect));
                                mods.Add(new ResistanceMod(ResistanceType.Energy, effect));

                                for (int i = 0; i < targ.Skills.Length; ++i)
                                {
                                    if (targ.Skills[i].Value > 0)
                                    {
                                        mods.Add(new DefaultSkillMod((SkillName)i, true, targ.Skills[i].Value * scalar));
                                    }
                                }
                            }
                            else
                            {
                                effect = (int)(from.Skills[SkillName.Discordance].Value / -5.0);
                                scalar = effect * 0.01;

                                mods.Add(new StatMod(StatType.Str, "DiscordanceStr", (int)(targ.RawStr * scalar), TimeSpan.Zero));
                                mods.Add(new StatMod(StatType.Int, "DiscordanceInt", (int)(targ.RawInt * scalar), TimeSpan.Zero));
                                mods.Add(new StatMod(StatType.Dex, "DiscordanceDex", (int)(targ.RawDex * scalar), TimeSpan.Zero));

                                for (int i = 0; i < targ.Skills.Length; ++i)
                                {
                                    if (targ.Skills[i].Value > 0)
                                    {
                                        mods.Add(new DefaultSkillMod((SkillName)i, true, targ.Skills[i].Value * scalar));
                                    }
                                }
                            }

                            DiscordanceInfo info = new DiscordanceInfo(from, targ, Math.Abs(effect), mods);
                            info.m_Timer = Timer.DelayCall(TimeSpan.Zero, TimeSpan.FromSeconds(1.25), ProcessDiscordance, info);

                            #region Bard Mastery Quest
                            if (from is PlayerMobile)
                            {
                                BaseQuest quest = QuestHelper.GetQuest((PlayerMobile)from, typeof(WieldingTheSonicBladeQuest));

                                if (quest != null)
                                {
                                    foreach (BaseObjective objective in quest.Objectives)
                                    {
                                        objective.Update(targ);
                                    }
                                }
                            }
                            #endregion

                            m_Table[targ] = info;
                        }
                        else
                        {
                            from.SendLocalizedMessage(1049540);                             // You fail to disrupt your target
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);
                        }

                        from.NextSkillTime = Core.TickCount + 12000;
                    }
                    else
                    {
                        m_Instrument.PlayInstrumentBadly(from);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1049535);                     // A song of discord would have no effect on that.
                }
            }
Esempio n. 53
0
			protected override void OnTarget( Mobile from, object targeted )
			{
				int number;

				if ( targeted is Key )
				{
					Key k = (Key)targeted;

					if ( k.m_KeyVal == 0 )
					{
						number = 501675; // This key is also blank.
					}
					else if ( from.CheckTargetSkill( SkillName.Tinkering, k, 0, 75.0 ) )
					{
						number = 501676; // You make a copy of the key.

						m_Key.Description = k.Description;
						m_Key.KeyValue = k.KeyValue;
						m_Key.Link = k.Link;
						m_Key.MaxRange = k.MaxRange;
					}
					else if ( Utility.RandomDouble() <= 0.1 ) // 10% chance to destroy the key
					{
						from.SendLocalizedMessage( 501677 ); // You fail to make a copy of the key.

						number = 501678; // The key was destroyed in the attempt.

						m_Key.Delete();
					}
					else
					{
						number = 501677; // You fail to make a copy of the key.
					}
				}
				else
				{
					number = 501688; // Not a key.
				}

				from.SendLocalizedMessage( number );
			}
Esempio n. 54
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                from.RevealingAction();

                if (!(targeted is Mobile))
                {
                    from.SendLocalizedMessage(1049528);                       // You cannot calm that!
                }
                else if (m_Instrument.Parent != from && !m_Instrument.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1062488);                       // The instrument you are trying to play is no longer in your backpack!
                }
                else if (targeted is Mobile)
                {
                    m_SetSkillTime     = false;
                    from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(10.0);

                    if (targeted == from)
                    {
                        // Standard mode : reset combatants for everyone in the area

                        if (!BaseInstrument.CheckMusicianship(from))
                        {
                            from.SendLocalizedMessage(500612);                               // You play poorly, and there is no effect.
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);
                        }
                        else if (!from.CheckSkill(SkillName.Peacemaking, 0.0, 120.0))
                        {
                            from.SendLocalizedMessage(500613);                               // You attempt to calm everyone, but fail.
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);
                        }
                        else
                        {
                            from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(5.0);
                            m_Instrument.PlayInstrumentWell(from);
                            m_Instrument.ConsumeUse(from);

                            double seconds = (from.Skills[SkillName.Musicianship].Value) / 10;

                            Map map = from.Map;

                            if (map != null)
                            {
                                int range = BaseInstrument.GetBardRange(from, SkillName.Peacemaking);

                                bool calmed = false;

                                foreach (Mobile m in from.GetMobilesInRange(range))
                                {
                                    if ((m is BaseCreature && ((BaseCreature)m).Uncalmable) || (m is BaseCreature && ((BaseCreature)m).AreaPeaceImmune) || m == from || !from.CanBeHarmful(m, false))
                                    {
                                        continue;
                                    }

                                    calmed = true;

                                    m.SendLocalizedMessage(500616);                                       // You hear lovely music, and forget to continue battling!
                                    m.Combatant = null;
                                    m.Warmode   = false;

                                    if (m is BaseCreature && !((BaseCreature)m).BardPacified)
                                    {
                                        ((BaseCreature)m).Pacify(from, DateTime.Now + TimeSpan.FromSeconds(seconds));
                                    }
                                }

                                if (!calmed)
                                {
                                    from.SendLocalizedMessage(1049648);                                       // You play hypnotic music, but there is nothing in range for you to calm.
                                }
                                else
                                {
                                    from.SendLocalizedMessage(500615);                                       // You play your hypnotic music, stopping the battle.
                                }
                            }
                        }
                    }
                    else
                    {
                        // Target mode : pacify a single target for a longer duration

                        Mobile targ = (Mobile)targeted;

                        if (!from.CanBeHarmful(targ, false))
                        {
                            from.SendLocalizedMessage(1049528);
                            m_SetSkillTime = true;
                        }
                        else if (targ is BaseCreature && ((BaseCreature)targ).Uncalmable)
                        {
                            from.SendLocalizedMessage(1049526);                               // You have no chance of calming that creature.
                            m_SetSkillTime = true;
                        }
                        else if (targ is BaseCreature && ((BaseCreature)targ).BardPacified)
                        {
                            from.SendLocalizedMessage(1049527);                               // That creature is already being calmed.
                            m_SetSkillTime = true;
                        }
                        else if (!BaseInstrument.CheckMusicianship(from))
                        {
                            from.SendLocalizedMessage(500612);                               // You play poorly, and there is no effect.
                            from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(5.0);
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);
                        }
                        else
                        {
                            double diff  = m_Instrument.GetDifficultyFor(targ) - 10.0;
                            double music = from.Skills[SkillName.Musicianship].Value;

                            if (music > 100.0)
                            {
                                diff -= (music - 100.0) * 0.5;
                            }

                            if (!from.CheckTargetSkill(SkillName.Peacemaking, targ, diff - 25.0, diff + 25.0))
                            {
                                from.SendLocalizedMessage(1049531);                                   // You attempt to calm your target, but fail.
                                m_Instrument.PlayInstrumentBadly(from);
                                m_Instrument.ConsumeUse(from);
                            }
                            else
                            {
                                m_Instrument.PlayInstrumentWell(from);
                                m_Instrument.ConsumeUse(from);

                                from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds(5.0);
                                if (targ is BaseCreature)
                                {
                                    BaseCreature bc = (BaseCreature)targ;

                                    from.SendLocalizedMessage(1049532);                                       // You play hypnotic music, calming your target.

                                    targ.Combatant = null;
                                    targ.Warmode   = false;

                                    double seconds = 100 - (diff / 1.5);

                                    if (seconds > 120)
                                    {
                                        seconds = 120;
                                    }
                                    else if (seconds < 10)
                                    {
                                        seconds = 10;
                                    }

                                    bc.Pacify(from, DateTime.Now + TimeSpan.FromSeconds(seconds));
                                }
                                else
                                {
                                    from.SendLocalizedMessage(1049532);                                      // You play hypnotic music, calming your target.

                                    targ.SendLocalizedMessage(500616);                                       // You hear lovely music, and forget to continue battling!
                                    targ.Combatant = null;
                                    targ.Warmode   = false;
                                }
                            }
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1049528);                       // You cannot calm that!
                }
            }
Esempio n. 55
0
            protected override void OnTarget( Mobile from, object targeted )
            {
                from.RevealingAction();

                if ( targeted is BaseCreature )
                {
                    BaseCreature creature = (BaseCreature)targeted;

                    if ( !m_Instrument.IsChildOf( from.Backpack ) )
                    {
                        from.SendAsciiMessage("The instrument you are trying to play is no longer in your backpack!"); // The instrument you are trying to play is no longer in your backpack!
                    }
                    else if ( m_Creature.Unprovokable || creature.Unprovokable )
                    {
                        from.SendAsciiMessage("You have no chance of provoking those creatures."); // You have no chance of provoking those creatures.
                    }
                    else if ( m_Creature.Map != creature.Map || !m_Creature.InRange( creature, BaseInstrument.GetBardRange( from, SkillName.Provocation ) ) )
                    {
                        from.SendAsciiMessage("The creatures you are trying to provoke are too far away from each other for your music to have an effect."); // The creatures you are trying to provoke are too far away from each other for your music to have an effect.
                    }
                    else if ( m_Creature != creature )
                    {
                        from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 6.0 );

                        double diff = ((m_Instrument.GetDifficultyFor( m_Creature ) + m_Instrument.GetDifficultyFor( creature )) * 0.5) - 5.0;
                        double music = from.Skills[SkillName.Musicianship].Value;

                        if ( music > 100.0 )
                            diff -= (music - 100.0) * 0.5;

                        if ( from.CanBeHarmful( m_Creature, true ) && from.CanBeHarmful( creature, true ) )
                        {
                            if ( !BaseInstrument.CheckMusicianship( from ) )
                            {
                                from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 6.0 );
                                //from.SayTo(from, true, "You play poorly, and there is no effect.");
                                from.SendAsciiMessage("You play poorly, and there is no effect."); // You play poorly, and there is no effect.
                                m_Instrument.PlayInstrumentBadly( from );
                                m_Instrument.ConsumeUse( from );
                            }
                            else
                            {
                                if ( !from.CheckTargetSkill(SkillName.Provocation, creature, 0, 100))
                                {
                                    from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 6.0 );
                                    //creature.SayTo(from, true, "Your music fails to incite enough anger.");
                                    from.SendAsciiMessage("Your music fails to incite enough anger."); // Your music fails to incite enough anger.
                                    m_Instrument.PlayInstrumentBadly( from );
                                    m_Instrument.ConsumeUse( from );
                                }
                                else
                                {
                                    //creature.SayTo(from, true, "Your music succeeds, as you start a fight.");
                                    from.SendAsciiMessage("Your music succeeds, as you start a fight."); // Your music succeeds, as you start a fight.
                                    m_Instrument.PlayInstrumentWell( from );
                                    m_Instrument.ConsumeUse( from );
                                    m_Creature.Provoke( from, creature, true );
                                }
                            }
                        }
                    }
                    else
                    {
                        from.SendAsciiMessage("You can't tell someone to attack themselves!"); // You can't tell someone to attack themselves!
                    }
                }
                else if ( targeted is Mobile )
                {
                    Mobile m = (Mobile)targeted;

                    if ( !m_Instrument.IsChildOf( from.Backpack ) )
                    {
                        from.SendAsciiMessage( "The instrument you are trying to play is no longer in your backpack!" ); // The instrument you are trying to play is no longer in your backpack!
                    }
                    else if ( m_Creature.Unprovokable )
                    {
                        from.SendAsciiMessage( "You have no chance of provoking those creatures." ); // You have no chance of provoking those creatures.
                    }
                    else if ( m_Creature.Map != m.Map || !m_Creature.InRange( m, BaseInstrument.GetBardRange( from, SkillName.Provocation ) ) )
                    {
                        from.SendAsciiMessage( "The creatures you are trying to provoke are too far away from each other for your music to have an effect." ); // The creatures you are trying to provoke are too far away from each other for your music to have an effect.
                    }
                    else
                    {
                        from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 6.0 );

                        double diff = ( ( m_Instrument.GetDifficultyFor( m_Creature ) + m_Instrument.GetDifficultyFor( m ) ) * 0.5 ) - 5.0;
                        double music = from.Skills[SkillName.Musicianship].Value;

                        if ( music > 100.0 )
                            diff -= ( music - 100.0 ) * 0.5;

                        if ( from.CanBeHarmful( m_Creature, true ) && from.CanBeHarmful( m, true ) )
                        {
                            if ( !BaseInstrument.CheckMusicianship( from ) )
                            {
                                from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 6.0 );
                                //from.SayTo(from, true, "You play poorly, and there is no effect.");
                                from.SendAsciiMessage( "You play poorly, and there is no effect." ); // You play poorly, and there is no effect.
                                m_Instrument.PlayInstrumentBadly( from );
                                m_Instrument.ConsumeUse( from );
                            }
                            else
                            {
                                if ( !from.CheckTargetSkill( SkillName.Provocation, m, 0, 100 ) )
                                {
                                    from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 6.0 );
                                    //creature.SayTo(from, true, "Your music fails to incite enough anger.");
                                    from.SendAsciiMessage( "Your music fails to incite enough anger." ); // Your music fails to incite enough anger.
                                    m_Instrument.PlayInstrumentBadly( from );
                                    m_Instrument.ConsumeUse( from );
                                }
                                else
                                {
                                    //creature.SayTo(from, true, "Your music succeeds, as you start a fight.");
                                    from.SendAsciiMessage( "Your music succeeds, as you start a fight." ); // Your music succeeds, as you start a fight.
                                    m_Instrument.PlayInstrumentWell( from );
                                    m_Instrument.ConsumeUse( from );
                                    m_Creature.Provoke( from, m, true );
                                }
                            }
                        }
                    }
                }
                else
                {
                    from.SendAsciiMessage( "You can't incite that!" ); // You can't incite that!
                }
            }
Esempio n. 56
0
 public virtual bool CheckReveal(Mobile m)
 {
     return(m.CheckTargetSkill(SkillName.DetectHidden, this, 80.0, 100.0));
 }
            protected override void OnTarget( Mobile from, object targeted )
            {
                from.RevealingAction();

                if ( !(targeted is Mobile) || ( targeted is PlayerMobile && targeted != from ) ) // PlayerMobile&&!From added by Silver
                {
                    from.SendLocalizedMessage( 1049528 ); // You cannot calm that!
                }
                else if ( !m_Instrument.IsChildOf( from.Backpack ) )
                {
                    from.SendLocalizedMessage( 1062488 ); // The instrument you are trying to play is no longer in your backpack!
                }
                else
                {
                    m_SetSkillTime = false;
                    from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 10.0 );

                    if ( targeted == from )
                    {
                        // Standard mode : reset combatants for everyone in the area

                        if ( !BaseInstrument.CheckMusicianship( from ) )
                        {
                            from.SendLocalizedMessage( 500612 ); // You play poorly, and there is no effect.
                            m_Instrument.PlayInstrumentBadly( from );
                            m_Instrument.ConsumeUse( from );
                        }
                        else if ( !from.CheckSkill( SkillName.Peacemaking, 0.0, Core.AOS ? 120.0 : from.Skills[SkillName.Peacemaking].Cap ) )
                        {
                            from.SendLocalizedMessage( 500613 ); // You attempt to calm everyone, but fail.
                            m_Instrument.PlayInstrumentBadly( from );
                            m_Instrument.ConsumeUse( from );
                        }
                        else
                        {
                            from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 5.0 );
                            m_Instrument.PlayInstrumentWell( from );
                            m_Instrument.ConsumeUse( from );

                            Map map = from.Map;

                            if ( map != null )
                            {
                                int range = BaseInstrument.GetBardRange( from, SkillName.Peacemaking );

                                bool calmed = false;

                                foreach ( Mobile m in from.GetMobilesInRange( range ) )
                                {
                                    if ((m is BaseCreature && ((BaseCreature)m).Uncalmable) || (m is BaseCreature && ((BaseCreature)m).AreaPeaceImmune) || m == from || !from.CanBeHarmful ( m, false ))
                                        continue;

                                    calmed = true;

                                    m.SendLocalizedMessage( 500616 ); // You hear lovely music, and forget to continue battling!
                                    m.Combatant = null;
                                    m.Warmode = false;

                                    if ( m is BaseCreature && !((BaseCreature)m).BardPacified )
                                        ((BaseCreature)m).Pacify( /*from,*/ DateTime.Now + TimeSpan.FromSeconds( 3.0 ) );
                                }

                                if ( !calmed )
                                    from.SendLocalizedMessage( 1049648 ); // You play hypnotic music, but there is nothing in range for you to calm.
                                else
                                    from.SendLocalizedMessage( 500615 ); // You play your hypnotic music, stopping the battle.
                            }
                        }
                    }
                    else
                    {
                        // Target mode : pacify a single target for a longer duration

                        Mobile targ = (Mobile)targeted;

                        if ( !from.CanBeHarmful( targ, false ) )
                        {
                            from.SendLocalizedMessage( 1049528 );
                            m_SetSkillTime = true;
                        }
                        else if ( targ is BaseCreature && ((BaseCreature)targ).Uncalmable )
                        {
                            from.SendLocalizedMessage( 1049526 ); // You have no chance of calming that creature.
                            m_SetSkillTime = true;
                        }
                        else if ( targ is BaseCreature && ((BaseCreature)targ).BardPacified )
                        {
                            from.SendLocalizedMessage( 1049527 ); // That creature is already being calmed.
                            m_SetSkillTime = true;
                        }
                        else if ( !BaseInstrument.CheckMusicianship( from ) )
                        {
                            from.SendLocalizedMessage( 500612 ); // You play poorly, and there is no effect.
                            from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 5.0 );
                            m_Instrument.PlayInstrumentBadly( from );
                            m_Instrument.ConsumeUse( from );
                        }
                        else
                        {
                            double diff = m_Instrument.GetDifficultyFor( targ ) - 10.0;
                            double music = from.Skills[SkillName.Musicianship].Value;

                            if ( music > 100.0 )
                                diff -= (music - 100.0) * 0.5;

                            if ( !from.CheckTargetSkill( SkillName.Peacemaking, targ, diff - 25.0, diff + 25.0 ) )
                            {
                                from.SendLocalizedMessage( 1049531 ); // You attempt to calm your target, but fail.
                                m_Instrument.PlayInstrumentBadly( from );
                                m_Instrument.ConsumeUse( from );
                            }
                            else
                            {
                                m_Instrument.PlayInstrumentWell( from );
                                m_Instrument.ConsumeUse( from );

                                from.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 5.0 );
                                if ( targ is BaseCreature )
                                {
                                    BaseCreature bc = (BaseCreature)targ;

                                    from.SendLocalizedMessage( 1049532 ); // You play hypnotic music, calming your target.

                                    targ.Combatant = null;
                                    targ.Warmode = false;

                                    double seconds = 100 - (diff / 1.5);

                                    if ( seconds > 120 )
                                        seconds = 120;
                                    else if ( seconds < 10 )
                                        seconds = 10;

                                    bc.Pacify( /*from,*/ DateTime.Now + TimeSpan.FromSeconds( seconds ) );
                                }
                                else
                                {
                                    from.SendLocalizedMessage( 1049532 ); // You play hypnotic music, calming your target.

                                    targ.SendLocalizedMessage( 500616 ); // You hear lovely music, and forget to continue battling!
                                    targ.Combatant = null;
                                    targ.Warmode = false;
                                }
                            }
                        }
                    }
                }
            }
Esempio n. 58
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Ore.Deleted)
                {
                    return;
                }

                if (!from.InRange(m_Ore.GetWorldLocation(), 2))
                {
                    from.SendLocalizedMessage(501976); // The ore is too far away.
                    return;
                }

                #region Combine Ore
                if (targeted is BaseOre)
                {
                    BaseOre ore = (BaseOre)targeted;

                    if (!ore.Movable)
                    {
                        return;
                    }
                    else if (m_Ore == ore)
                    {
                        from.SendLocalizedMessage(501972); // Select another pile or ore with which to combine
                        from.Target = new InternalTarget(ore);
                        return;
                    }
                    else if (ore.Resource != m_Ore.Resource)
                    {
                        from.SendLocalizedMessage(501979); // You cannot combine ores of different metals.
                        return;
                    }

                    int worth = ore.Amount;

                    if (ore.ItemID == 0x19B9)
                    {
                        worth *= 8;
                    }
                    else if (ore.ItemID == 0x19B7)
                    {
                        worth *= 2;
                    }
                    else
                    {
                        worth *= 4;
                    }

                    int sourceWorth = m_Ore.Amount;

                    if (m_Ore.ItemID == 0x19B9)
                    {
                        sourceWorth *= 8;
                    }
                    else if (m_Ore.ItemID == 0x19B7)
                    {
                        sourceWorth *= 2;
                    }
                    else
                    {
                        sourceWorth *= 4;
                    }

                    worth += sourceWorth;

                    int plusWeight = 0;
                    int newID      = ore.ItemID;

                    if (ore.DefaultWeight != m_Ore.DefaultWeight)
                    {
                        if (ore.ItemID == 0x19B7 || m_Ore.ItemID == 0x19B7)
                        {
                            newID = 0x19B7;
                        }
                        else if (ore.ItemID == 0x19B9)
                        {
                            newID      = m_Ore.ItemID;
                            plusWeight = ore.Amount * 2;
                        }
                        else
                        {
                            plusWeight = m_Ore.Amount * 2;
                        }
                    }

                    if ((ore.ItemID == 0x19B9 && worth > 120000) || ((ore.ItemID == 0x19B8 || ore.ItemID == 0x19BA) && worth > 60000) || (ore.ItemID == 0x19B7 && worth > 30000))
                    {
                        from.SendLocalizedMessage(1062844); // There is too much ore to combine.
                        return;
                    }
                    else if (ore.RootParent is Mobile && (plusWeight + ((Mobile)ore.RootParent).Backpack.TotalWeight) > ((Mobile)ore.RootParent).Backpack.MaxWeight)
                    {
                        from.SendLocalizedMessage(501978); // The weight is too great to combine in a container.
                        return;
                    }

                    ore.ItemID = newID;

                    if (ore.ItemID == 0x19B9)
                    {
                        ore.Amount = worth / 8;
                    }
                    else if (ore.ItemID == 0x19B7)
                    {
                        ore.Amount = worth / 2;
                    }
                    else
                    {
                        ore.Amount = worth / 4;
                    }

                    m_Ore.Delete();
                    return;
                }
                #endregion

                if (IsForge(targeted))
                {
                    double difficulty;

                    #region Void Pool Rewards
                    bool             talisman = false;
                    SmeltersTalisman t        = from.FindItemOnLayer(Layer.Talisman) as SmeltersTalisman;
                    if (t != null && t.Resource == m_Ore.Resource)
                    {
                        talisman = true;
                    }
                    #endregion

                    switch (m_Ore.Resource)
                    {
                    default:
                        difficulty = 50.0;
                        break;

                    case CraftResource.DullCopper:
                        difficulty = 65.0;
                        break;

                    case CraftResource.ShadowIron:
                        difficulty = 70.0;
                        break;

                    case CraftResource.Copper:
                        difficulty = 75.0;
                        break;

                    case CraftResource.Bronze:
                        difficulty = 80.0;
                        break;

                    case CraftResource.Gold:
                        difficulty = 85.0;
                        break;

                    case CraftResource.Agapite:
                        difficulty = 90.0;
                        break;

                    case CraftResource.Verite:
                        difficulty = 95.0;
                        break;

                    case CraftResource.Valorite:
                        difficulty = 99.0;
                        break;
                    }

                    double minSkill = difficulty - 25.0;
                    double maxSkill = difficulty + 25.0;

                    if (difficulty > 50.0 && difficulty > from.Skills[SkillName.Mining].Value && !talisman)
                    {
                        from.SendLocalizedMessage(501986); // You have no idea how to smelt this strange ore!
                        return;
                    }

                    if (m_Ore.ItemID == 0x19B7 && m_Ore.Amount < 2)
                    {
                        from.SendLocalizedMessage(501987); // There is not enough metal-bearing ore in this pile to make an ingot.
                        return;
                    }

                    if (talisman || from.CheckTargetSkill(SkillName.Mining, targeted, minSkill, maxSkill))
                    {
                        int toConsume = m_Ore.Amount;

                        if (toConsume <= 0)
                        {
                            from.SendLocalizedMessage(501987); // There is not enough metal-bearing ore in this pile to make an ingot.
                        }
                        else
                        {
                            if (toConsume > 30000)
                            {
                                toConsume = 30000;
                            }

                            int ingotAmount;

                            if (m_Ore.ItemID == 0x19B7)
                            {
                                ingotAmount = toConsume / 2;

                                if (toConsume % 2 != 0)
                                {
                                    --toConsume;
                                }
                            }
                            else if (m_Ore.ItemID == 0x19B9)
                            {
                                ingotAmount = toConsume * 2;
                            }
                            else
                            {
                                ingotAmount = toConsume;
                            }

                            BaseIngot ingot = m_Ore.GetIngot();
                            ingot.Amount = ingotAmount;

                            if (m_Ore.HasSocket <Caddellite>())
                            {
                                ingot.AttachSocket(new Caddellite());
                            }

                            m_Ore.Consume(toConsume);
                            from.AddToBackpack(ingot);
                            //from.PlaySound( 0x57 );

                            if (talisman && t != null)
                            {
                                t.UsesRemaining--;
                                from.SendLocalizedMessage(1152620); // The magic of your talisman guides your hands as you purify the metal. Success is ensured!
                            }
                            else
                            {
                                from.SendLocalizedMessage(501988); // You smelt the ore removing the impurities and put the metal in your backpack.
                            }
                        }
                    }
                    else
                    {
                        if (m_Ore.Amount < 2)
                        {
                            if (m_Ore.ItemID == 0x19B9)
                            {
                                m_Ore.ItemID = 0x19B8;
                            }
                            else
                            {
                                m_Ore.ItemID = 0x19B7;
                            }
                        }
                        else
                        {
                            m_Ore.Amount /= 2;
                        }

                        from.SendLocalizedMessage(501990); // You burn away the impurities but are left with less useable metal.
                    }
                }
            }
Esempio n. 59
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Axe.Deleted)
                {
                    return;
                }

                else if (!from.Items.Contains(m_Axe))
                {
                    from.SendMessage("You must be holding that weapon to use it.");
                }


                else if (targeted is Mobile)
                {
                    Mobile m = (Mobile)targeted;

                    if (m != from && from.HarmfulCheck(m))
                    {
                        Direction to = from.GetDirectionTo(m);

                        from.Direction = to;

                        from.Animate(from.Mounted ? 26 : 9, 7, 1, true, false, 0);

                        if (from.CheckTargetSkill(SkillName.Throwing, m, 40.0, 100.0))
                        {
                            from.MovingEffect(m, 0x1BFE, 7, 1, false, false, 0x481, 0);

                            int distance = (int)from.GetDistanceToSqrt(m.Location);

                            int mindamage = m_Axe.MinDamage;
                            if (from.Dex > 100)
                                mindamage += 2;

                            distance -= (int)from.Skills[SkillName.Tactics].Value / 20;
                            if (distance < 0)
                                distance = 0;

                            int count = (int)from.Skills[SkillName.Throwing].Value / 10;
                            count += (int)from.Skills[SkillName.Anatomy].Value / 20;
                            if (distance > 6)
                                count -= distance - 5;

                            AOS.Damage(m, from,Utility.Random(mindamage,count) - distance/2, true,0,0,0,0,0,0,100,false,false,false);

                            m_Axe.MoveToWorld(m.Location, m.Map);
                        }
                        else
                        {
                            int x = 0, y = 0;

                            switch (to & Direction.Mask)
                            {
                                case Direction.North: --y; break;
                                case Direction.South: ++y; break;
                                case Direction.West: --x; break;
                                case Direction.East: ++x; break;
                                case Direction.Up: --x; --y; break;
                                case Direction.Down: ++x; ++y; break;
                                case Direction.Left: --x; ++y; break;
                                case Direction.Right: ++x; --y; break;
                            }

                            x += Utility.Random(-1, 3);
                            y += Utility.Random(-1, 3);

                            x += m.X;
                            y += m.Y;

                            m_Axe.MoveToWorld(new Point3D(x, y, m.Z), m.Map);

                            from.MovingEffect(m_Axe, 0x1BFE, 7, 1, false, false, 0x481, 0);

                           
                            

                            from.SendMessage("You miss.");
                        }
                        m_Axe.HitPoints -= 1;
                    }
                    
                }
            }
Esempio n. 60
0
            protected override void OnTarget(Mobile from, object target)
            {
                if (target is Mobile)
                {
                    if (from.CheckTargetSkill(SkillName.Forensics, target, 40.0, 100.0))
                    {
                        if (target is PlayerMobile && ((PlayerMobile)target).NpcGuild == NpcGuild.ThievesGuild)
                        {
                            from.SendLocalizedMessage(501004);                              //That individual is a thief!
                        }
                        else
                        {
                            from.SendLocalizedMessage(501003);                              //You notice nothing unusual.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(501001);                          //You cannot determain anything useful.
                    }
                }
                else if (target is Coffer)
                {
                    Coffer coffer = (Coffer)target;

                    if (coffer.CofferRobbed > 0)
                    {
                        from.SendMessage("It seems that " + coffer.CofferRobber + " has robbed this coffer of it's gold!");
                    }
                    else
                    {
                        from.SendMessage("That coffer has not been emptied by thieves.");
                    }
                }
                else if (target is LandChest)
                {
                    from.SendMessage("This adventurer looks to have been slain by some wild animal.");
                }
                else if (target is WaterChest)
                {
                    from.SendMessage("Maybe the owner of this boat fell into the sea and drowned.");
                }
                else if (target is Corpse)
                {
                    if (from.CheckTargetSkill(SkillName.Forensics, target, 0.0, 100.0))
                    {
                        Corpse c = (Corpse)target;

                        if (c.m_Forensicist != null)
                        {
                            from.SendLocalizedMessage(1042750, c.m_Forensicist);                                // The forensicist  ~1_NAME~ has already discovered that:
                        }
                        else
                        {
                            c.m_Forensicist = from.Name;
                        }

                        if (((Body)c.Amount).IsHuman)
                        {
                            from.SendLocalizedMessage(1042751, (c.Killer == null ? "no one" : c.Killer.Name));                                //This person was killed by ~1_KILLER_NAME~
                        }
                        if (c.Looters.Count > 0)
                        {
                            StringBuilder sb = new StringBuilder();
                            for (int i = 0; i < c.Looters.Count; i++)
                            {
                                if (i > 0)
                                {
                                    sb.Append(", ");
                                }
                                sb.Append(((Mobile)c.Looters[i]).Name);
                            }

                            from.SendLocalizedMessage(1042752, sb.ToString());                              //This body has been distrubed by ~1_PLAYER_NAMES~
                        }
                        else
                        {
                            from.SendLocalizedMessage(501002);                              //The corpse has not be desecrated.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(501001);                          //You cannot determine anything useful.
                    }
                }
                else if (target is ILockpickable)
                {
                    ILockpickable p = (ILockpickable)target;
                    if (p.Picker != null)
                    {
                        from.SendLocalizedMessage(1042749, p.Picker.Name);                          //This lock was opened by ~1_PICKER_NAME~
                    }
                    else
                    {
                        from.SendLocalizedMessage(501003);                          //You notice nothing unusual.
                    }
                }
            }