Inheritance: BaseBeverage
        public override void OnDoubleClick( Mobile from )
        {
            if( from == null || !( from is PlayerMobile ) || from.Deleted || !from.Alive || from.Frozen || from.Paralyzed )
                return;

            PlayerMobile pm = from as PlayerMobile;

            if( pm.BloodOfXorgoth != null )
            {
                from.SendMessage( "You are already under the effect of Blood of Xorgoth." );
                return;
            }

            if( from.Backpack != null && this.ParentEntity == from.Backpack )
            {
                BasePotion.PlayDrinkEffectNoBottle( from );
                from.Emote( "*lets out a roar after drinking the Blood of Xorgoth*" );
                pm.BloodOfXorgoth = new BloodOfXorgothTimer( pm, this.Power );
                pm.BloodOfXorgoth.Start();
                this.Delete();
                Pitcher pitcher = new Pitcher();
                from.Backpack.DropItem( pitcher );
            }

            else
                from.SendMessage( "That needs to be in your backpack for you to use it." );
        }
Beispiel #2
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!from.InRange(GetWorldLocation(), 2))
            {
                from.SendLocalizedMessage(500446); // That is too far away.
            }
            else
            {
                DateTime now = DateTime.Now;
                //if (now.Hour != 20)  //Set the time you wish this to at.  Current 8:00 p.m.
                //{
                //    from.SendMessage("The stone only works on the 20th phase of the moons.");

                //}

                //else
                {
                    Item item = from.Backpack.FindItemByType(typeof(Pitcher));

                    if (item == null)// if is not item is found
                    {
                        //check to see if they have a mug.
                        switch (Utility.Random(4))  //picks one of the following
                        {
                        case 0:
                            Effects.PlaySound(Location, Map, 0x44A);
                            from.SendMessage("The bar tender yells, 'Get a pitcher!'");
                            break;

                        case 1:
                            Effects.PlaySound(Location, Map, 0x41F);
                            from.SendMessage("Your tongue gets stuck in the tap.  You wish you had used a pitcher.");
                            //freeze player to 5 sec.
                            break;

                        case 2:
                            Effects.PlaySound(Location, Map, 0x03E);
                            from.SendMessage("The waitres throws a pitcher at you.");
                            break;

                        case 3:
                            Effects.PlaySound(Location, Map, 0x174);
                            from.SendMessage("The other paterns, holding pitchers, frown at you as you try to drink directly from the keg.");
                            break;
                        }
                    }
                    else
                    {                  //give user a drink. Use MugAle or GlassMug
                        //Destroy();       <-- delete keg
                        item.Delete(); // <-- delete pitcher
                        Effects.PlaySound(Location, Map, 0x04E);



                        switch (Utility.Random(7)) //picks one of the following
                        {
                        case 0:                    //good
                        {
                            Pitcher p = new Pitcher();
                            p.Content  = BeverageType.Water;
                            p.Quantity = 5;

                            from.Backpack.AddItem(p);
                            break;
                        }

                        case 2:      //good
                        {
                            Pitcher p = new Pitcher();
                            p.Content  = BeverageType.Ale;
                            p.Quantity = 5;

                            from.Backpack.AddItem(p);
                            break;
                        }

                        case 3:      //good
                        {
                            Pitcher p = new Pitcher();
                            p.Content  = BeverageType.Cider;
                            p.Quantity = 5;

                            from.Backpack.AddItem(p);
                            break;
                        }

                        case 4:      //good
                        {
                            Pitcher p = new Pitcher();
                            p.Content  = BeverageType.Liquor;
                            p.Quantity = 5;

                            from.Backpack.AddItem(p);
                            break;
                        }

                        case 5:
                        {
                            Pitcher p = new Pitcher();
                            p.Content  = BeverageType.Milk;
                            p.Quantity = 5;

                            from.Backpack.AddItem(p);
                            break;
                        }

                        case 6:
                        {
                            Pitcher p = new Pitcher();
                            p.Content  = BeverageType.Wine;
                            p.Quantity = 5;

                            from.Backpack.AddItem(p);
                            break;
                        }
                        }
                    }
                }
            }
        }
Beispiel #3
0
            protected override void OnTarget( Mobile from, object obj )
            {
                if( from == null || water == null || !( obj is BaseCreature || obj is BaseWeapon) || !( from is PlayerMobile ) || from.Deleted || !from.Alive || from.Frozen || from.Paralyzed )
                    return;

                Container pack = from.Backpack;

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

                    if( weapon.RootParentEntity == null || weapon.RootParentEntity != from )
                        from.SendMessage( "The weapon needs to be in your possession to be consecrated." );

                    else if( weapon.Resource == CraftResource.Silver )
                    {
                        XmlHolyWater hwatt = XmlAttach.FindAttachment( weapon, typeof(XmlHolyWater) ) as XmlHolyWater;

                        if( hwatt != null )
                            from.SendMessage( "That weapon has already been consecrated." );

                        else if( pack != null && water.ParentEntity == pack )
                        {
                            XmlHolyWater newatt = new XmlHolyWater( Math.Max( 1, (int)(water.Power * 0.1) ), 600.0 );
                            XmlAttach.AttachTo( weapon, newatt );
                            from.SendMessage( "This weapon will remain consecrated for the next ten minutes." );
                            water.Delete();
                            Pitcher pitcher = new Pitcher();
                            weapon.InvalidateProperties();
                            pack.DropItem( pitcher );
                        }
                    }

                    else
                        from.SendMessage( "Only silver weapons can be consecrated with holy water." );

                    return;
                }

                if( !( obj is IAbyssal ) && !( obj is IUndead ) && (!(obj is PlayerMobile) && !((PlayerMobile)obj).IsVampire) )
                {
                    from.SendMessage( "Holy Water is only effective against demons and the undead." );
                    return;
                }

                BaseCreature bc = obj as BaseCreature;

                if( bc.Deleted || from.Map != bc.Map || !bc.Alive || !from.CanSee( bc ) || !from.InLOS( bc ) || !from.CanBeHarmful( bc ) )
                    return;

                PlayerMobile m = from as PlayerMobile;

                if( pack != null && water.ParentEntity == pack )
                {
                    if( BaseWeapon.CheckStam( m, 6 ) )
                    {
                        new BaseCustomSpell.SpellDamageTimer( m, bc, 0.5, water.Power ).Start();
                        from.Emote( "*throws a vial of holy water on " + bc.Name + "*" );
                        Effects.SendLocationParticles( EffectItem.Create(   bc.Location, bc.Map, EffectItem.DefaultDuration ), 0x3728, 10, 10, 5023 );
                        bc.PlaySound( 868 );
                        water.Delete();
                        Pitcher pitcher = new Pitcher();
                        pack.DropItem( pitcher );
                    }
                }

                else
                    from.SendMessage( "That needs to be in your backpack for you to use it." );
            }
Beispiel #4
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            bool allowItem = false;

            if (!HasAccess(from))
            {
                from.SendLocalizedMessage(1073821); // You do not have access to that item for use with the aquarium.
                return(false);
            }

            if (dropped is Pitcher)
            {
                Pitcher item = dropped as Pitcher;

                if (item.Content != BeverageType.Water)
                {
                    from.SendMessage("You cannot pour that into the aquarium.");
                    return(false);
                }

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

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

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

                        from.PlaySound(0x4E);

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

                        return(false);
                    }

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

            if (dropped is BaseBeverage)
            {
                BaseBeverage item = dropped as BaseBeverage;

                if (item.IsEmpty || !item.Pourable || item.Content != BeverageType.Water)
                {
                    from.SendLocalizedMessage(500840); // Can't pour that in there.
                    return(false);
                }

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

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

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

                        from.PlaySound(0x4E);

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

                        return(false);
                    }

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

            if (dropped is AquariumItem)
            {
                AquariumItem item = dropped as AquariumItem;

                switch (item.ItemType)
                {
                case AquariumItem.Type.Fish:
                    if (m_FishItems.Count >= MaxFish)
                    {
                        from.SendMessage("That aquarium cannot hold any more fish.");
                        return(false);
                    }

                    else
                    {
                        from.CloseGump(typeof(AquariumGump));
                        from.SendMessage("You add the fish to the aquarium.");

                        m_FishItems.Add(item);
                        item.Internalize();

                        Splash();
                        Splash();

                        from.CloseGump(typeof(AquariumGump));
                        from.SendGump(new AquariumGump(this, from, 0));

                        return(true);
                    }
                    break;

                case AquariumItem.Type.Decoration:
                    if (m_DecorationItems.Count >= MaxDecorations)
                    {
                        from.SendMessage("That aquarium cannot hold any more decorative items.");
                        return(false);
                    }

                    else
                    {
                        from.CloseGump(typeof(AquariumGump));
                        from.SendMessage("You add the decoration to the aquarium.");

                        m_DecorationItems.Add(item);
                        item.Internalize();

                        Splash();
                        Splash();

                        from.CloseGump(typeof(AquariumGump));
                        from.SendGump(new AquariumGump(this, from, 0));

                        return(true);
                    }
                    break;
                }
            }

            return(allowItem);
        }
Beispiel #5
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!from.InRange(GetWorldLocation(), 2))
            {
                from.SendLocalizedMessage(500446); // That is too far away. 
            }
            else
            {
                DateTime now = DateTime.Now;
                //if (now.Hour != 20)  //Set the time you wish this to at.  Current 8:00 p.m.
                //{
                //    from.SendMessage("The stone only works on the 20th phase of the moons.");

                //}

                //else
                {
                    Item item = from.Backpack.FindItemByType(typeof(Pitcher));

                    if (item == null)// if is not item is found
                    {
                        //check to see if they have a mug.
                        switch (Utility.Random(4))  //picks one of the following
                        {
                            case 0:
                                Effects.PlaySound(Location, Map, 0x44A);
                                from.SendMessage("The bar tender yells, 'Get a pitcher!'");
                                break;
                            case 1:
                                Effects.PlaySound(Location, Map, 0x41F);
                                from.SendMessage("Your tongue gets stuck in the tap.  You wish you had used a pitcher.");
                                //freeze player to 5 sec.
                                break;
                            case 2:
                                Effects.PlaySound(Location, Map, 0x03E);
                                from.SendMessage("The waitres throws a pitcher at you.");
                                break;
                            case 3:
                                Effects.PlaySound(Location, Map, 0x174);
                                from.SendMessage("The other paterns, holding pitchers, frown at you as you try to drink directly from the keg.");
                                break;
                        }
                    }
                    else
                    {//give user a drink. Use MugAle or GlassMug
                        //Destroy();       <-- delete keg 
                        item.Delete();  // <-- delete pitcher
                        Effects.PlaySound(Location, Map, 0x04E);



                        switch (Utility.Random(7))  //picks one of the following
                        {
                            case 0: //good
                                {
                                    Pitcher p = new Pitcher();
                                    p.Content = BeverageType.Water;
                                    p.Quantity = 5;

                                    from.Backpack.AddItem(p);
                                    break;
                                }
                            case 2:  //good
                                {
                                    Pitcher p = new Pitcher();
                                    p.Content = BeverageType.Ale;
                                    p.Quantity = 5;

                                    from.Backpack.AddItem(p);
                                    break;
                                }
                            case 3:  //good
                                {
                                    Pitcher p = new Pitcher();
                                    p.Content = BeverageType.Cider;
                                    p.Quantity = 5;

                                    from.Backpack.AddItem(p);
                                    break;
                                }
                            case 4:  //good
                                {
                                    Pitcher p = new Pitcher();
                                    p.Content = BeverageType.Liquor;
                                    p.Quantity = 5;

                                    from.Backpack.AddItem(p);
                                    break;
                                }
                            case 5:
                                {
                                    Pitcher p = new Pitcher();
                                    p.Content = BeverageType.Milk;
                                    p.Quantity = 5;

                                    from.Backpack.AddItem(p);
                                    break;
                                }
                            case 6:
                                {
                                    Pitcher p = new Pitcher();
                                    p.Content = BeverageType.Wine;
                                    p.Quantity = 5;

                                    from.Backpack.AddItem(p);
                                    break;
                                }
                        }
                    }

                }
            }
        }
Beispiel #6
0
 protected override void OnTarget(Mobile from, object targ)
 {
     if (targ is FarmCow)
     {
         FarmCow c = (FarmCow)targ;
         if (c.Owner == from || c.Owner == null)
         {
             bool CanUse = from.CheckSkill(SkillName.AnimalLore, 20, 50);
             if (CanUse)
             {
                 if (c.Milk > 0)
                 {
                     if (t_mb.Quantity < 10)
                     {
                         c.PlaySound(c.GetIdleSound());
                         from.SendMessage("You milk the cow.");
                         if (t_mb.Quantity < 1)
                         {
                             t_mb.Age = DateTime.UtcNow;
                         }
                         int tofill = 10 - t_mb.Quantity;
                         if (c.Milk > tofill)
                         {
                             t_mb.Quantity = 10;
                             c.Milk       -= tofill;
                             if (t_mb.MilkType != TypeOfMilk.Cow && t_mb.MilkType != TypeOfMilk.None)
                             {
                                 t_mb.MilkType = TypeOfMilk.Mixed;
                             }
                             else
                             {
                                 t_mb.MilkType = TypeOfMilk.Cow;
                             }
                         }
                         else
                         {
                             t_mb.Quantity += c.Milk;
                             c.Milk         = 0;
                             if (t_mb.MilkType != TypeOfMilk.Cow && t_mb.MilkType != TypeOfMilk.None)
                             {
                                 t_mb.MilkType = TypeOfMilk.Mixed;
                             }
                             else
                             {
                                 t_mb.MilkType = TypeOfMilk.Cow;
                             }
                         }
                         t_mb.InvalidateProperties();
                         t_mb.UpdateName();
                     }
                     else
                     {
                         from.SendMessage("Your milk bucket is full!");
                     }
                 }
                 else
                 {
                     from.SendMessage("That animal is out of milk.");
                 }
             }
             else
             {
                 c.PlaySound(c.GetIdleSound());
                 from.SendMessage("You fail to milk the cow!");
             }
         }
         else
         {
             from.SendMessage("You don't own that animal.");
         }
     }
     else if (targ is FarmSheep)
     {
         FarmSheep c = (FarmSheep)targ;
         if (c.Owner == from || c.Owner == null)
         {
             bool CanUse = from.CheckSkill(SkillName.AnimalLore, 20, 50);
             if (CanUse)
             {
                 if (c.Milk > 0)
                 {
                     if (t_mb.Quantity < 10)
                     {
                         c.PlaySound(c.GetIdleSound());
                         from.SendMessage("You milk the sheep.");
                         if (t_mb.Quantity < 1)
                         {
                             t_mb.Age = DateTime.UtcNow;
                         }
                         int tofill = 10 - t_mb.Quantity;
                         if (c.Milk > tofill)
                         {
                             t_mb.Quantity = 10;
                             c.Milk       -= tofill;
                             if (t_mb.MilkType != TypeOfMilk.Sheep && t_mb.MilkType != TypeOfMilk.None)
                             {
                                 t_mb.MilkType = TypeOfMilk.Mixed;
                             }
                             else
                             {
                                 t_mb.MilkType = TypeOfMilk.Sheep;
                             }
                         }
                         else
                         {
                             t_mb.Quantity += c.Milk;
                             c.Milk         = 0;
                             if (t_mb.MilkType != TypeOfMilk.Sheep && t_mb.MilkType != TypeOfMilk.None)
                             {
                                 t_mb.MilkType = TypeOfMilk.Mixed;
                             }
                             else
                             {
                                 t_mb.MilkType = TypeOfMilk.Sheep;
                             }
                         }
                         t_mb.InvalidateProperties();
                         t_mb.UpdateName();
                     }
                     else
                     {
                         from.SendMessage("Your milk bucket is full!");
                     }
                 }
                 else
                 {
                     from.SendMessage("That animal is out of milk.");
                 }
             }
             else
             {
                 c.PlaySound(c.GetIdleSound());
                 from.SendMessage("You fail to milk the sheep!");
             }
         }
         else
         {
             from.SendMessage("You don't own that animal.");
         }
     }
     else if (targ is FarmGoat)
     {
         FarmGoat c = (FarmGoat)targ;
         if (c.Owner == from || c.Owner == null)
         {
             bool CanUse = from.CheckSkill(SkillName.AnimalLore, 20, 50);
             if (CanUse)
             {
                 if (c.Milk > 0)
                 {
                     if (t_mb.Quantity < 10)
                     {
                         c.PlaySound(c.GetIdleSound());
                         from.SendMessage("You milk the goat.");
                         if (t_mb.Quantity < 1)
                         {
                             t_mb.Age = DateTime.UtcNow;
                         }
                         int tofill = 10 - t_mb.Quantity;
                         if (c.Milk > tofill)
                         {
                             t_mb.Quantity = 10;
                             c.Milk       -= tofill;
                             if (t_mb.MilkType != TypeOfMilk.Goat && t_mb.MilkType != TypeOfMilk.None)
                             {
                                 t_mb.MilkType = TypeOfMilk.Mixed;
                             }
                             else
                             {
                                 t_mb.MilkType = TypeOfMilk.Goat;
                             }
                         }
                         else
                         {
                             t_mb.Quantity += c.Milk;
                             c.Milk         = 0;
                             if (t_mb.MilkType != TypeOfMilk.Goat && t_mb.MilkType != TypeOfMilk.None)
                             {
                                 t_mb.MilkType = TypeOfMilk.Mixed;
                             }
                             else
                             {
                                 t_mb.MilkType = TypeOfMilk.Goat;
                             }
                         }
                         t_mb.InvalidateProperties();
                         t_mb.UpdateName();
                     }
                     else
                     {
                         from.SendMessage("Your milk bucket is full!");
                     }
                 }
                 else
                 {
                     from.SendMessage("That animal is out of milk.");
                 }
             }
             else
             {
                 c.PlaySound(c.GetIdleSound());
                 from.SendMessage("You fail to milk the goat!");
             }
         }
         else
         {
             from.SendMessage("You don't own that animal.");
         }
     }
     else if (targ is Pitcher)
     {
         Pitcher bev = (Pitcher)targ;
         if (bev.Content == BeverageType.Milk || bev.Quantity < 1)
         {
             bev.Content = BeverageType.Milk;
             if (t_mb.Quantity > (bev.MaxQuantity - bev.Quantity))
             {
                 t_mb.Quantity -= (bev.MaxQuantity - bev.Quantity);
                 bev.Quantity   = bev.MaxQuantity;
             }
             else
             {
                 bev.Quantity += t_mb.Quantity;
                 t_mb.Quantity = 0;
             }
             t_mb.InvalidateProperties();
             t_mb.UpdateName();
             from.PlaySound(0x4E);
         }
         else
         {
             from.SendMessage("You shouldn't mix beverages.");
         }
     }
     else if (targ is MilkKeg)
     {
         MilkKeg bev = (MilkKeg)targ;
         if (bev.Quantity < 100)
         {
             if (bev.MilkType == t_mb.MilkType || bev.Quantity < 1)
             {
                 bev.MilkType = t_mb.MilkType;
                 if (bev.Quantity < 1)
                 {
                     bev.Age = t_mb.Age;
                 }
                 if (bev.Age > t_mb.Age)
                 {
                     bev.Age = t_mb.Age;
                 }
                 if (t_mb.Quantity > (100 - bev.Quantity))
                 {
                     t_mb.Quantity -= (100 - bev.Quantity);
                     bev.Quantity   = 100;
                 }
                 else
                 {
                     bev.Quantity += t_mb.Quantity;
                     t_mb.Quantity = 0;
                 }
                 t_mb.InvalidateProperties();
                 t_mb.UpdateName();
                 bev.InvalidateProperties();
                 bev.UpdateName();
                 from.PlaySound(0x4E);
                 from.SendMessage("You pour the milk into the keg.");
             }
             else
             {
                 bev.MilkType = TypeOfMilk.Mixed;
                 if (bev.Quantity < 1)
                 {
                     bev.Age = t_mb.Age;
                 }
                 if (bev.Age > t_mb.Age)
                 {
                     bev.Age = t_mb.Age;
                 }
                 if (t_mb.Quantity > (100 - bev.Quantity))
                 {
                     t_mb.Quantity -= (100 - bev.Quantity);
                     bev.Quantity   = 100;
                 }
                 else
                 {
                     bev.Quantity += t_mb.Quantity;
                     t_mb.Quantity = 0;
                 }
                 t_mb.InvalidateProperties();
                 t_mb.UpdateName();
                 bev.InvalidateProperties();
                 bev.UpdateName();
                 from.PlaySound(0x4E);
                 from.SendMessage("You pour the milk into the keg.");
             }
         }
         else
         {
             from.SendMessage("That is full!");
         }
     }
     else if (targ is MeasuringCup)
     {
         if (t_mb.Quantity > 0)
         {
             from.AddToBackpack(new Milk());
             from.PlaySound(0x240);
             from.SendMessage("You measure out one cup of milk.");
             t_mb.Quantity -= 1;
             t_mb.InvalidateProperties();
             t_mb.UpdateName();
         }
         else
         {
             from.SendMessage("The bucket is empty!");
         }
     }
     else
     {
         from.SendMessage("You can't do that.");
     }
 }