Inheritance: Item, IHasQuantity
Example #1
0
        public override void OnDoubleClick(Mobile from)
        {
            if (Empty)
            {
                // A foggy memory is recalled and you have to ask yourself, "Why is the Pungent Brew always gone?"
                from.PrivateOverheadMessage(Network.MessageType.Regular, 0x3B2, 1113610, from.NetState);
            }
            else
            {
                from.PlaySound(Utility.RandomList(0x30, 0x2D6));

                from.BAC = 60;
                BaseBeverage.CheckHeaveTimer(from);

                if (!m_Table.ContainsKey(from))
                {
                    from.SendLocalizedMessage(1095139);                       // Flint wasn't kidding. This brew is strong!

                    InternalTimer t = m_Table[from] = new InternalTimer(from);
                    t.Start();
                }
                else
                {
                    InternalTimer t = m_Table[from];
                    t.Counter = 20;
                }

                Empty = true;
            }
        }
Example #2
0
        public void Pour(Mobile from, Item item)
        {
            if (item is BaseBeverage)
            {
                BaseBeverage beverage = (BaseBeverage)item;
                if (beverage.IsEmpty || !beverage.Pourable || beverage.Content != BeverageType.Water)
                {
                    from.SendMessage("You can only put water in here!");
                    return;
                }

                if (m_fill < 6)
                {
                    m_fill++;
                    beverage.Quantity--;
                    from.PlaySound(0x4E);

                    if (m_fill == 6)
                    {
                        from.SendMessage("You completely fill the sprinkler.");
                    }
                    else
                    {
                        from.SendMessage("You dump some water into the sprinkler");
                    }
                }
                else
                {
                    from.SendMessage("It's already full.");
                }
            }
        }
Example #3
0
        public static void HandleThrow(BaseBeverage beverage, WaterElemental elemental, Mobile thrower)
        {
            if (!beverage.IsFull)
            {
                thrower.SendLocalizedMessage(1113038);  // It is not full.
            }
            else if (!thrower.InRange(elemental.Location, 5))
            {
                thrower.SendLocalizedMessage(500295);   // You are too far away to do that.
            }
            else if (!elemental.HasDecanter)
            {
                thrower.SendLocalizedMessage(1115895);  // It seems that this water elemental no longer has a magical decanter...
            }
            else if (0.1 > Utility.RandomDouble())
            {
                thrower.RevealingAction();
                elemental.Damage(1, thrower);

                elemental.HasDecanter = false;
                beverage.Delete();
                thrower.AddToBackpack(new EndlessDecanter());
                thrower.SendLocalizedMessage(1115897);  // The water elemental has thrown a magical decanter back to you!
            }
            else
            {
                thrower.RevealingAction();
                elemental.Damage(1, thrower);

                beverage.Delete();
                thrower.PlaySound(0x040);
                thrower.SendLocalizedMessage(1115896);  // The water pitcher has shattered.
            }
        }
Example #4
0
        public void Drink(Mobile from)
        {
            if (Thirsty(from, m_FillFactor))
            {
                from.PlaySound(Utility.Random(0x30, 2));

                if (from.Body.IsHuman && !from.Mounted)
                {
                    from.Animate(34, 5, 1, true, false, 0);
                }

                if (m_Poison != null)
                {
                    from.ApplyPoison(m_Poisoner, m_Poison);
                }

                int bac = 5;
                from.BAC += bac;
                if (from.BAC > 60)
                {
                    from.BAC = 60;
                }

                BaseBeverage.CheckHeaveTimer(from);

                this.Consume();

                Item item = EmptyItem;

                if (item != null)
                {
                    from.AddToBackpack(item);
                }
            }
        }
Example #5
0
        public override void OnDoubleClick(Mobile from)
        {
            base.OnDoubleClick(from);

            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1075438); // You can only drink from the goblet of celebration when its in your inventory.
            }
            else
            {
                if (m_Full)
                {
                    from.SendLocalizedMessage(1075272); // You drink from the goblet of celebration

                    Full = false;

                    from.BAC = 60;
                    BaseBeverage.CheckHeaveTimer(from);
                }
                else
                {
                    from.SendLocalizedMessage(1075439); // You need to wait a day for the goblet of celebration to be replenished.
                }
            }
        }
        public override Item Construct()
        {
            Item item;

            int index = Utility.Random(m_Types.Length);

            if (m_Types[index] == typeof(BeverageBottle))
            {
                item = new BeverageBottle(m_Content);
            }
            else if (m_Types[index] == typeof(Jug))
            {
                item = new Jug(m_Content);
            }
            else
            {
                item = base.Construct();

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

                    bev.Content  = m_Content;
                    bev.Quantity = bev.MaxQuantity;
                }
            }

            return(item);
        }
Example #7
0
        public static void HandleThrow(BaseBeverage beverage, WaterElemental elemental, Mobile thrower)
        {
            if (!beverage.IsFull)
            {
                thrower.SendLocalizedMessage(1113038);
            }
            else if (!thrower.InRange(elemental.Location, 5))   // It is not full. 
            {
                thrower.SendLocalizedMessage(500295);   // You are too far away to do that.
            }
            else if (!elemental.HasDecanter)
            {
                thrower.SendLocalizedMessage(1115895);  // It seems that this water elemental no longer has a magical decanter...
            }
            else if (0.1 > Utility.RandomDouble())
            {
                thrower.RevealingAction();
                elemental.Damage(1, thrower);

                elemental.HasDecanter = false;
                beverage.Delete();
                thrower.AddToBackpack(new EndlessDecanter());
                thrower.SendLocalizedMessage(1115897);  // The water elemental has thrown a magical decanter back to you!
            }
            else
            {
                thrower.RevealingAction();
                elemental.Damage(1, thrower);

                beverage.Delete();
                thrower.PlaySound(0x040);
                thrower.SendLocalizedMessage(1115896);  // The water pitcher has shattered.
            }
        }
Example #8
0
        public bool GetWaterFromContainer(Mobile from, object target)
        {
            if (target is BaseBeverage)
            {
                BaseBeverage beverage = target as BaseBeverage;

                if (beverage.Quantity >= 1 && beverage.Content == BeverageType.Water)
                {
                    beverage.Quantity--;
                    return(true);
                }
            }

            else if (target is BaseWaterContainer)
            {
                BaseWaterContainer waterContainer = target as BaseWaterContainer;

                if (waterContainer.Quantity >= 1)
                {
                    waterContainer.Quantity--;
                    return(true);
                }
            }

            else if (target is IWaterSource)
            {
                IWaterSource waterSource = target as IWaterSource;

                if (waterSource.Quantity >= 1)
                {
                    waterSource.Quantity--;
                    return(true);
                }
            }

            else
            {
                Item         item = (Item)target;
                IWaterSource waterSource;

                waterSource = (item as IWaterSource);

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

                    if (waterSource != null)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Example #9
0
        public void GetDrunk(Mobile m)
        {
            m.SendMessage("Yo ho, Yo ho, a pirate's life for you");
            int bac = 30;

            m.BAC += bac;
            if (m.BAC > 60)
            {
                m.BAC = 60;
            }

            BaseBeverage.CheckHeaveTimer(m);
        }
Example #10
0
        public static bool ConsumeTotal(Container pack, Type itemType, BeverageType content, int quantity)
        {
            Item[] items = pack.FindItemsByType(itemType);

            // First pass, compute total
            int total = 0;

            for (int i = 0; i < items.Length; ++i)
            {
                BaseBeverage bev = items[i] as BaseBeverage;

                if (bev != null && bev.Content == content && !bev.IsEmpty)
                {
                    total += bev.Quantity;
                }
            }

            if (total >= quantity)
            {
                // We've enough, so consume it

                int need = quantity;

                for (int i = 0; i < items.Length; ++i)
                {
                    BaseBeverage bev = items[i] as BaseBeverage;

                    if (bev == null || bev.Content != content || bev.IsEmpty)
                    {
                        continue;
                    }

                    int theirQuantity = bev.Quantity;

                    if (theirQuantity < need)
                    {
                        bev.Quantity = 0;
                        need        -= theirQuantity;
                    }
                    else
                    {
                        bev.Quantity -= need;
                        return(true);
                    }
                }
            }

            return(false);
        }
Example #11
0
        public static void CheckWaterSource(Mobile from, BaseBeverage beverage, Item item)
        {
            if (from.Region.IsPartOf <KhaldunCampRegion>())
            {
                beverage.Content  = BeverageType.Water;
                beverage.Poison   = null;
                beverage.Poisoner = null;

                beverage.Quantity = beverage.MaxQuantity;

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

                beverage.AttachSocket(new Caddellite());
            }
        }
Example #12
0
        public static bool IsWaterContainer(object target)
        {
            if (target is BaseBeverage)
            {
                BaseBeverage beverage = target as BaseBeverage;

                if (beverage.Content == BeverageType.Water)
                {
                    return(true);
                }
            }

            else if (target is BaseWaterContainer)
            {
                BaseWaterContainer waterContainer = target as BaseWaterContainer;

                return(true);
            }

            else if (target is IWaterSource)
            {
                IWaterSource waterSource = target as IWaterSource;

                return(true);
            }

            else
            {
                Item         item = (Item)target;
                IWaterSource waterSource;

                waterSource = (item as IWaterSource);

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

                    if (waterSource != null)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Example #13
0
        public void OnAfterTarget(Mobile m, bool found, BaseBeverage bev)
        {
            if (found)
            {
                int amt = this.Amount;

                if (bev != null && bev.Content == BeverageType.Water && bev.Poison != null)
                {
                    --bev.Quantity;
                    m.ApplyPoison(bev.Poisoner, bev.Poison);
                    m.SendMessage("The water was poisoned!");
                    return;
                }
                else if (bev != null && bev.Content == BeverageType.Water && ConsumeBeverages)
                {
                    if (amt > bev.Quantity * ConsumeRatio)
                    {
                        amt = bev.Quantity * ConsumeRatio;
                    }

                    int toConsume = Math.Min(bev.Quantity, (amt - 1) / 10 + 1) * 10;
                    bev.Quantity -= toConsume / 10;
                    int bandageCount = Math.Min(toConsume, amt);
                    m.AddToBackpack(new Bandage(bandageCount));
                    m.SendMessage("You wash {0} bloody bandage{1} and put the clean bandage{1} in your pack.", bandageCount > 1 ? bandageCount.ToString() : "the", bandageCount > 1 ? "s" : "");
                    if ((this.Amount -= bandageCount) <= 0)
                    {
                        this.Delete();
                    }
                }
                else
                {
                    m.AddToBackpack(new Bandage(amt));
                    m.SendMessage("You wash {0} bloody bandage{1} and put the clean bandage{1} in your pack.", amt > 1 ? amt.ToString() : "the", amt > 1 ? "s" : "");
                    this.Delete();
                }
            }
            else
            {
                m.SendMessage("You can only wash bloody bandages in water.");
            }
        }
Example #14
0
        public void Pour(Mobile from, BaseBeverage beverage)
        {
            if (beverage.Content == BeverageType.Water)
            {
                if (Items.Count > 0)
                {
                    from.SendLocalizedMessage(500848);                                                             // Couldn't pour it there.  It was already full.
                    beverage.PrivateOverheadMessage(Server.Network.MessageType.Regular, 0, 500841, from.NetState); // that has somethign in it.
                }
                else
                {
                    var barrel = new WaterBarrel();
                    barrel.Movable = false;
                    barrel.MoveToWorld(Location, Map);

                    beverage.Pour_OnTarget(from, barrel);
                    Delete();
                }
            }
        }
Example #15
0
 public override void OnDoubleClick(Mobile from)
 {
     if (m_CurrentUses > 0)
     {
         if (from.Thirst < 20)
         {
             ++from.Thirst;
         }
         from.BAC += 5;
         if (from.BAC > 60)
         {
             from.BAC = 60;
         }
         BaseBeverage.CheckHeaveTimer(from);
         --m_CurrentUses;
         from.PlaySound(Utility.RandomList(0x30, 0x2D6));
     }
     else
     {
         from.BeginTarget(-1, true, TargetFlags.None, new TargetCallback(Fill));
         SendLocalizedMessageTo(from, 500837);                   // Fill from what?
     }
 }
Example #16
0
        public void Pour(Mobile from, BaseBeverage bev)
        {
            if (!bev.IsEmpty && bev.Pourable && bev.Content == BeverageType.Water && bev.ValidateUse(from, false))
            {
                if (m_Stage == EggStage.Burnt)
                {
                    from.SendMessage("You decide not to water the burnt egg.");
                }
                else if (m_WaterLevel < (int)m_Stage)
                {
                    bev.Quantity--;

                    m_WaterLevel++;
                    from.PlaySound(0x4E);

                    InvalidateProperties();
                }
                else
                {
                    from.SendMessage("You decide not to water the egg since it doesn't need it.");
                }
            }
        }
Example #17
0
        public void Fill(Mobile from, object targ)
        {
            if (m_CurrentUses < 1 && targ is BaseBeverage)
            {
                BaseBeverage bev = (BaseBeverage)targ;

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

                if (bev.Quantity > m_MaxUses)
                {
                    m_CurrentUses = m_MaxUses;
                    bev.Quantity -= m_MaxUses;
                }
                else
                {
                    m_CurrentUses += bev.Quantity;
                    bev.Quantity   = 0;
                }
            }
        }
Example #18
0
 public PlayerDrinkingEventArgs( Player player, BaseBeverage bvgItem )
     : base(player)
 {
     BeverageItem = bvgItem;
 }
Example #19
0
        public virtual void Fill_OnTarget(Mobile from, object targ)
        {
            if (!IsEmpty || !Fillable || !ValidateUse(from, false))
            {
                return;
            }

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

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

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

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

                src = (item as IWaterSource);

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

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

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

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

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

                from.SendLocalizedMessage(1010089);                   // You fill the container with water.
            }
        }
Example #20
0
        public virtual void Pour_OnTarget(Mobile from, object targ)
        {
            if (IsEmpty || !Pourable || !ValidateUse(from, false))
            {
                return;
            }

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

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

                if (bev.IsFull && bev.Content == this.Content)
                {
                    from.SendLocalizedMessage(500848);                       // Couldn't pour it there.  It was already full.
                }
                else if (!bev.IsEmpty)
                {
                    from.SendLocalizedMessage(500846);                       // Can't pour it there.
                }
                else
                {
                    bev.Content  = this.Content;
                    bev.Poison   = this.Poison;
                    bev.Poisoner = this.Poisoner;

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

                    from.PlaySound(0x4E);
                }
            }
            else if (from == targ)
            {
                if (from.Thirst < 20)
                {
                    from.Thirst += 1;
                }

                if (ContainsAlchohol)
                {
                    int heaves = 0;

                    switch (this.Content)
                    {
                    case BeverageType.Ale: heaves = 3; break;

                    case BeverageType.Wine: heaves = 5; break;

                    case BeverageType.Cider: heaves = 5; break;

                    case BeverageType.Liquor: heaves = 10; break;

                    default:                                heaves = 5; break;
                    }

                    from.BAC += heaves;

                    if (from.BAC > 60)
                    {
                        from.BAC = 60;
                    }

                    CheckHeaveTimer(from);
                }

                from.PlaySound(Utility.RandomList(0x30, 0x2D6));

                if (m_Poison != null)
                {
                    from.ApplyPoison(m_Poisoner, m_Poison);
                }

                --Quantity;
            }
            else if (targ is SackFlour)
            {
                SackFlour flour = (SackFlour)targ;
                --Quantity;
                flour.Quantity--;
                if (flour.Deleted)
                {
                    from.SendAsciiMessage("No flour left.");
                }
                from.SendAsciiMessage("You make some dough and put it in your backpack");
                from.AddToBackpack(new Dough());
            }
            else
            {
                from.SendLocalizedMessage(500846);                   // Can't pour it there.
            }
        }
Example #21
0
 public ThrowTarget(BaseBeverage bomb)
     : base(12, true, TargetFlags.None)
 {
     m_Bomb = bomb;
 }
Example #22
0
        public virtual void Pour_OnTarget(Mobile from, object targ)
        {
            if (IsEmpty || !Pourable || !ValidateUse(from, false))
            {
                return;
            }

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

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

                if (bev.IsFull && bev.Content == this.Content)
                {
                    from.SendLocalizedMessage(500848);   // Couldn't pour it there.  It was already full.
                }
                else if (!bev.IsEmpty)
                {
                    from.SendLocalizedMessage(500846);   // Can't pour it there.
                }
                else
                {
                    bev.Content  = this.Content;
                    bev.Poison   = this.Poison;
                    bev.Poisoner = this.Poisoner;

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

                    from.PlaySound(0x4E);
                }
            }
            else if (from == targ)
            {
                if (from.Thirst < 20)
                {
                    from.Thirst += 1;
                }

                if (ContainsAlchohol)
                {
                    int bac = 0;

                    switch (this.Content)
                    {
                    case BeverageType.Ale: bac = 1; break;

                    case BeverageType.Wine: bac = 2; break;

                    case BeverageType.Cider: bac = 3; break;

                    case BeverageType.Liquor: bac = 4; break;
                    }

                    from.BAC += bac;

                    if (from.BAC > 60)
                    {
                        from.BAC = 60;
                    }

                    CheckHeaveTimer(from);
                }

                from.PlaySound(Utility.RandomList(0x30, 0x2D6));

                if (m_Poison != null)
                {
                    from.ApplyPoison(m_Poisoner, m_Poison);
                }

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

                if (Content != BeverageType.Water)
                {
                    from.SendLocalizedMessage(500842);   // Can't pour that in there.
                }
                else if (bwc.Items.Count != 0)
                {
                    from.SendLocalizedMessage(500841);   // That has something in it.
                }
                else
                {
                    int itNeeds = Math.Min(bwc.MaxQuantity - bwc.Quantity, Quantity);

                    if (itNeeds > 0)
                    {
                        bwc.Quantity += itNeeds;
                        Quantity     -= itNeeds;

                        from.PlaySound(0x4E);
                    }
                }
            }
            else if (targ is PlantItem)
            {
                ((PlantItem)targ).Pour(from, this);
            }
            else
            {
                from.SendLocalizedMessage(500846);   // Can't pour it there.
            }
        }
Example #23
0
 public BeverageEntry(Mobile from, BaseBeverage beverage)
     : base(10176, 1)
 {
     m_From = from;
     m_Beverage = beverage;
 }
Example #24
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (!HasAccess(from))
            {
                from.SendLocalizedMessage(1073821); // You do not have access to that item for use with the aquarium.
                return(false);
            }

            if (m_VacationLeft > 0)
            {
                from.SendLocalizedMessage(1074427); // The aquarium is in vacation mode.
                return(false);
            }

            bool takeItem = true;

            if (dropped is FishBowl)
            {
                FishBowl bowl = (FishBowl)dropped;

                if (bowl.Empty || !AddFish(from, bowl.Fish))
                {
                    return(false);
                }

                bowl.InvalidateProperties();

                takeItem = false;
            }
            else if (dropped is BaseFish)
            {
                BaseFish fish = (BaseFish)dropped;

                if (!AddFish(from, fish))
                {
                    return(false);
                }
            }
            else if (dropped is VacationWafer)
            {
                m_VacationLeft = VacationWafer.VacationDays;
                dropped.Delete();

                from.SendLocalizedMessage(1074428, m_VacationLeft.ToString()); // The aquarium will be in vacation mode for ~1_DAYS~ days
            }
            else if (dropped is AquariumFood)
            {
                m_Food.Added += 1;
                dropped.Delete();

                from.SendLocalizedMessage(1074259, "1"); // ~1_NUM~ unit(s) of food have been added to the aquarium.
            }
            else if (dropped is BaseBeverage)
            {
                BaseBeverage beverage = (BaseBeverage)dropped;

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

                m_Water.Added     += 1;
                beverage.Quantity -= 1;

                from.PlaySound(0x4E);
                from.SendLocalizedMessage(1074260, "1"); // ~1_NUM~ unit(s) of water have been added to the aquarium.

                takeItem = false;
            }
            else if (!AddDecoration(from, dropped))
            {
                takeItem = false;
            }

            from.CloseGump(typeof(AquariumGump));

            InvalidateProperties();

            if (takeItem)
            {
                from.PlaySound(0x42);
            }

            return(takeItem);
        }
Example #25
0
        public void OnAfterTarget(Mobile m, bool found, BaseBeverage bev)
        {
            if (found)
            {
                int amt = this.Amount;

                if (bev != null && bev.Content == BeverageType.Water && bev.Poison != null)
                {
                    --bev.Quantity;
                    m.ApplyPoison(bev.Poisoner, bev.Poison);
                    m.SendMessage("The water was poisoned!");
                    return;
                }
                else if (bev != null && bev.Content == BeverageType.Water && ConsumeBeverages)
                {
                    if (amt > bev.Quantity * ConsumeRatio)
                        amt = bev.Quantity * ConsumeRatio;

                    int toConsume = Math.Min(bev.Quantity, (amt - 1) / 10 + 1) * 10;
                    bev.Quantity -= toConsume / 10;
                    int bandageCount = Math.Min(toConsume, amt);
                    m.AddToBackpack(new Bandage(bandageCount));
                    m.SendMessage("You wash {0} bloody bandage{1} and put the clean bandage{1} in your pack.", bandageCount > 1 ? bandageCount.ToString() : "the", bandageCount > 1 ? "s" : "");
                    if ((this.Amount -= bandageCount) <= 0)
                        this.Delete();
                }
                else
                {
                    m.AddToBackpack(new Bandage(amt));
                    m.SendMessage("You wash {0} bloody bandage{1} and put the clean bandage{1} in your pack.", amt > 1 ? amt.ToString() : "the", amt > 1 ? "s" : "");
                    this.Delete();
                }
            }
            else
                m.SendMessage("You can only wash bloody bandages in water.");
        }
        public void OnTarget(Mobile from, object obj)
        {
            // TODO: Need details on how oil cloths should get consumed here

            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
            }
            else if (obj is BaseWeapon)
            {
                BaseWeapon weapon = (BaseWeapon)obj;

                if (weapon.RootParent != from)
                {
                    from.SendLocalizedMessage(1005425);                       // You may only wipe down items you are holding or carrying.
                }
                else if (weapon.Poison == null || weapon.PoisonCharges <= 0)
                {
                    from.LocalOverheadMessage(Network.MessageType.Regular, 0x3B2, 1005422);                       // Hmmmm... this does not need to be cleaned.
                }
                else
                {
                    if (weapon.PoisonCharges < 2)
                    {
                        weapon.PoisonCharges = 0;
                    }
                    else
                    {
                        weapon.PoisonCharges -= 2;
                    }

                    if (weapon.PoisonCharges > 0)
                    {
                        from.SendLocalizedMessage(1005423);                           // You have removed some of the caustic substance, but not all.
                    }
                    else
                    {
                        from.SendLocalizedMessage(1010497);                           // You have cleaned the item.
                    }
                }
            }
            else if (obj == from && obj is PlayerMobile)
            {
                PlayerMobile pm = (PlayerMobile)obj;

                if (pm.BodyMod == 183 || pm.BodyMod == 184)
                {
                    pm.SavagePaintExpiration = TimeSpan.Zero;

                    pm.BodyMod = 0;
                    pm.HueMod  = -1;

                    from.SendLocalizedMessage(1040006);                       // You wipe away all of your body paint.

                    Consume();
                }
                else if (pm.HueMod == 298)
                {
                    from.SendMessage("With some elbow grease, you manage to rub off the dye.");
                    Consume();
                    pm.HueMod = -1;
                }
                else
                {
                    from.LocalOverheadMessage(Network.MessageType.Regular, 0x3B2, 1005422);                       // Hmmmm... this does not need to be cleaned.
                }
            }
//Added for Firebomb
            else if (obj is BaseBeverage)
            {
                BaseBeverage beverage = (BaseBeverage)obj;

                if (beverage.Content == BeverageType.Liquor)
                {
                    Firebomb bomb = new Firebomb(beverage.ItemID);
                    bomb.Name = beverage.Name;
                    Point3D loc = beverage.Location;
                    beverage.Delete();

                    from.AddToBackpack(bomb);
                    bomb.Location = loc;
                    from.SendLocalizedMessage(1060580);                       // You prepare a firebomb.
                    Consume();
                }
            }
            else if (obj is Firebomb)
            {
                from.SendLocalizedMessage(1060579);                   // That is already a firebomb!
            }
//Firebomb end
            else
            {
                from.SendLocalizedMessage(1005426);                   // The cloth will not work on that.
            }
        }
Example #27
0
        public virtual void Pour_OnTarget(Mobile from, object targ)
        {
            if (IsEmpty || !Pourable || !ValidateUse(from, false))
            {
                return;
            }

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

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

                if (bev.IsFull && bev.Content == this.Content)
                {
                    from.SendLocalizedMessage(500848);                       // Couldn't pour it there.  It was already full.
                }
                else if (!bev.IsEmpty)
                {
                    from.SendLocalizedMessage(500846);                       // Can't pour it there.
                }
                else
                {
                    bev.Content  = this.Content;
                    bev.Poison   = this.Poison;
                    bev.Poisoner = this.Poisoner;

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

                    from.PlaySound(0x4E);
                }
            }
            else if (from == targ)
            {
// new additions by Alari: fill messages for thirst and no drinking when full.

                if (from.Thirst >= 20)
                {
                    from.SendMessage("You are simply too full to drink any more!");
                    return;
                }

                int fillFactor = 4;                     // how much each 'drink' should fill your thirst.

                int iThirst = from.Thirst + fillFactor;

                if (from.Stam < from.StamMax)
                {
                    from.Stam += Utility.Random(6, 3) + fillFactor / 5;                       // restore some stamina
                }
                if (iThirst >= 20)
                {
                    from.Thirst = 20;
                    from.SendMessage("You manage to drink the beverage, but you are full!");
                }
                else
                {
                    from.Thirst = iThirst;

                    if (iThirst < 5)
                    {
                        from.SendMessage("You drink the beverage, but are still extremely thirsty.");
                    }
                    else if (iThirst < 10)
                    {
                        from.SendMessage("You drink the beverage, and begin to feel more satiated.");
                    }
                    else if (iThirst < 15)
                    {
                        from.SendMessage("After drinking the beverage, you feel much less thirsty.");
                    }
                    else
                    {
                        from.SendMessage("You feel quite full after consuming the beverage.");
                    }
                }

// end modifications

                if (ContainsAlchohol)
                {
                    int bac = 0;

                    switch (this.Content)
                    {
                    case BeverageType.Ale: bac = 1; break;

                    case BeverageType.Wine: bac = 2; break;

                    case BeverageType.Cider: bac = 3; break;

                    case BeverageType.Liquor: bac = 4; break;
                    }

                    from.BAC += bac;

                    if (from.BAC > 60)
                    {
                        from.BAC = 60;
                    }

                    CheckHeaveTimer(from);
                }

                from.PlaySound(Utility.RandomList(0x30, 0x2D6));

                if (m_Poison != null)
                {
                    from.ApplyPoison(m_Poisoner, m_Poison);
                }

                --Quantity;
            }
            else if (targ is PlantItem)
            {
                ((PlantItem)targ).Pour(from, this);
            }
            else if (targ is AddonComponent &&
                     (((AddonComponent)targ).Addon is WaterVatEast || ((AddonComponent)targ).Addon is WaterVatSouth) &&
                     this.Content == BeverageType.Water)
            {
                PlayerMobile player = from as PlayerMobile;

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

                    if (qs != null)
                    {
                        QuestObjective obj = qs.FindObjective(typeof(GatherWaterObjective));

                        if (obj != null && !obj.Completed)
                        {
                            BaseAddon vat = ((AddonComponent)targ).Addon;

                            if (vat.X > 5784 && vat.X < 5814 && vat.Y > 1903 && vat.Y < 1934 &&
                                ((qs.RedSolen && vat.Map == Map.Trammel) || (!qs.RedSolen && vat.Map == Map.Felucca)))
                            {
                                if (obj.CurProgress + Quantity > obj.MaxProgress)
                                {
                                    int delta = obj.MaxProgress - obj.CurProgress;

                                    Quantity       -= delta;
                                    obj.CurProgress = obj.MaxProgress;
                                }
                                else
                                {
                                    obj.CurProgress += Quantity;
                                    Quantity         = 0;
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(500846);                   // Can't pour it there.
            }
        }
Example #28
0
 public ThrowTarget( BaseBeverage bomb )
     : base(12, true, TargetFlags.None)
 {
     m_Bomb = bomb;
 }
Example #29
0
        public virtual void Pour_OnTarget(Mobile from, object targ)
        {
            if (IsEmpty || !Pourable || !ValidateUse(from, false))
            {
                return;
            }

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

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

                if (bev.IsFull && bev.Content == this.Content)
                {
                    from.SendLocalizedMessage(500848);                       // Couldn't pour it there.  It was already full.
                }
                else if (!bev.IsEmpty)
                {
                    from.SendLocalizedMessage(500846);                       // Can't pour it there.
                }
                else
                {
                    bev.Content  = this.Content;
                    bev.Poison   = this.Poison;
                    bev.Poisoner = this.Poisoner;

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

                    from.PlaySound(0x4E);
                }
            }
            else if (from == targ)
            {
                if (from.Thirst < 20)
                {
                    from.Thirst += 1;
                }

                if (ContainsAlchohol)
                {
                    int bac = 0;

                    switch (this.Content)
                    {
                    case BeverageType.Ale: bac = 1; break;

                    case BeverageType.Wine: bac = 2; break;

                    case BeverageType.Cider: bac = 3; break;

                    case BeverageType.Liquor: bac = 4; break;
                    }

                    from.BAC += bac;

                    if (from.BAC > 60)
                    {
                        from.BAC = 60;
                    }

                    CheckHeaveTimer(from);
                }

                from.PlaySound(Utility.RandomList(0x30, 0x2D6));

                if (m_Poison != null)
                {
                    from.ApplyPoison(m_Poisoner, m_Poison);
                }

                --Quantity;
            }
            else if (targ is PlantItem)
            {
                ((PlantItem)targ).Pour(from, this);
            }
            else if (targ is AddonComponent &&
                     (((AddonComponent)targ).Addon is WaterVatEast || ((AddonComponent)targ).Addon is WaterVatSouth) &&
                     this.Content == BeverageType.Water)
            {
                PlayerMobile player = from as PlayerMobile;

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

                    if (qs != null)
                    {
                        QuestObjective obj = qs.FindObjective(typeof(GatherWaterObjective));

                        if (obj != null && !obj.Completed)
                        {
                            BaseAddon vat = ((AddonComponent)targ).Addon;

                            if (vat.X > 5784 && vat.X < 5814 && vat.Y > 1903 && vat.Y < 1934 &&
                                ((qs.RedSolen && vat.Map == Map.Trammel) || (!qs.RedSolen && vat.Map == Map.Felucca)))
                            {
                                if (obj.CurProgress + Quantity > obj.MaxProgress)
                                {
                                    int delta = obj.MaxProgress - obj.CurProgress;

                                    Quantity       -= delta;
                                    obj.CurProgress = obj.MaxProgress;
                                }
                                else
                                {
                                    obj.CurProgress += Quantity;
                                    Quantity         = 0;
                                }
                            }
                        }
                    }
                }
            }
            else if (targ is WaterElemental)
            {
                WaterElemental we = targ as WaterElemental;

                if (this is Pitcher && this.Quantity == this.MaxQuantity)
                {
                    if (we.Summoned == true)
                    {
                        from.SendLocalizedMessage(1115895);                           // It seems that this water elemental no longer has a magical decanter...
                    }
                    else if (we.HasPitcher == false)
                    {
                        from.SendLocalizedMessage(1115895);                           // It seems that this water elemental no longer has a magical decanter...
                    }
                    else
                    {
                        Effects.SendMovingEffect(from, we, this.ItemID, 7, 0, false, false, this.Hue, 0);

                        if (Utility.Random(100) < 3)
                        {
                            EndlessDecanterOfWater edw = new EndlessDecanterOfWater();

                            Effects.SendMovingEffect(we, from, edw.ItemID, 7, 0, false, false, edw.Hue, 0);

                            from.AddToBackpack(edw);
                            from.SendLocalizedMessage(1115897);                               // The water elemental has thrown a magical decanter back to you!
                            we.HasPitcher = false;
                        }
                        else
                        {
                            from.SendLocalizedMessage(1115896);                               // The water pitcher has shattered.
                            //Play Sound?
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500846);                       // Can't pour it there.
                }
            }
            else
            {
                from.SendLocalizedMessage(500846);                   // Can't pour it there.
            }
        }
Example #30
0
        public virtual void Pour_OnTarget(Mobile from, object targ)
        {
            if (IsEmpty || !Pourable || !ValidateUse(from, false))
            {
                return;
            }

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

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

                if (bev.IsFull && bev.Content == this.Content)
                {
                    from.SendLocalizedMessage(500848);                       // Couldn't pour it there.  It was already full.
                }
                else if (!bev.IsEmpty)
                {
                    from.SendLocalizedMessage(500846);                       // Can't pour it there.
                }
                else
                {
                    bev.Content  = this.Content;
                    bev.Poison   = this.Poison;
                    bev.Poisoner = this.Poisoner;

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

                    from.PlaySound(0x4E);
                }
            }
            else if (from == targ)
            {
                if (from.Thirst < 20)
                {
                    from.Thirst += 1;
                }

                if (ContainsAlchohol)
                {
                    int bac = 0;

                    switch (this.Content)
                    {
                    case BeverageType.Ale: bac = 1; break;

                    case BeverageType.Wine: bac = 2; break;

                    case BeverageType.Cider: bac = 3; break;

                    case BeverageType.Liquor: bac = 4; break;
                    }

                    from.BAC += bac;

                    if (from.BAC > 60)
                    {
                        from.BAC = 60;
                    }

                    CheckHeaveTimer(from);
                }

                from.PlaySound(Utility.RandomList(0x30, 0x2D6));

                if (m_Poison != null)
                {
                    from.ApplyPoison(m_Poisoner, m_Poison);
                }

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

                if (Content != BeverageType.Water)
                {
                    from.SendLocalizedMessage(500842);                       // Can't pour that in there.
                }
                else if (bwc.Items.Count != 0)
                {
                    from.SendLocalizedMessage(500841);                       // That has something in it.
                }
                else
                {
                    int itNeeds = Math.Min((bwc.MaxQuantity - bwc.Quantity), Quantity);

                    if (itNeeds > 0)
                    {
                        bwc.Quantity += itNeeds;
                        Quantity     -= itNeeds;

                        from.PlaySound(0x4E);
                    }
                }
            }
            else if (targ is PlantItem)
            {
                ((PlantItem)targ).Pour(from, this);
            }
            else if (targ is AddonComponent &&
                     (((AddonComponent)targ).Addon is WaterVatEast || ((AddonComponent)targ).Addon is WaterVatSouth) &&
                     this.Content == BeverageType.Water)
            {
                PlayerMobile player = from as PlayerMobile;

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

                    if (qs != null)
                    {
                        QuestObjective obj = qs.FindObjective(typeof(GatherWaterObjective));

                        if (obj != null && !obj.Completed)
                        {
                            BaseAddon vat = ((AddonComponent)targ).Addon;

                            if (vat.X > 5784 && vat.X < 5814 && vat.Y > 1903 && vat.Y < 1934 &&
                                ((qs.RedSolen && vat.Map == Map.Trammel) || (!qs.RedSolen && vat.Map == Map.Felucca)))
                            {
                                if (obj.CurProgress + Quantity > obj.MaxProgress)
                                {
                                    int delta = obj.MaxProgress - obj.CurProgress;

                                    Quantity       -= delta;
                                    obj.CurProgress = obj.MaxProgress;
                                }
                                else
                                {
                                    obj.CurProgress += Quantity;
                                    Quantity         = 0;
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(500846);                   // Can't pour it there.
            }
        }
Example #31
0
        /* le target aura 2 effets , si c'est un animal a traire , il extrait du lait en echange de 2 point de Bouffe
         * si c'est une bouteille il extrait 1L du seau et fait une bouteille pleine , chaque lait a une propriété soif
         * allant de 1 a 3 pour le lait de chevre , on pourra transformez cela en faim avec les fromages */

        // google translates

        /* the target will have 2 effects, if it is an animal has to milk,
         * it extracts from milk in exchange of 2 point from Puffs out if it is a bottle it
         * extracts 1L from the bucket and makes a full bottle, each milk has a property thirst
         * going for 1 A 3 for the goat's milk, one will be able transform that into hunger with cheeses */


        protected override void OnTarget(Mobile from, object o)
        {
            Container pack = from.Backpack;

            if (o is Mobile)
            {
                m_mobile = (Mobile)o;
            }

            if ((m_varsaut.m_laitage == 0) && (m_varsaut.m_bestiole == 0) && m_mobile != null)
            {
                if (m_mobile is Sheep)
                {
                    m_varsaut.m_bestiole = 1;
                    //m_varsaut.Name ="Milk Bucket: " + m_varsaut.m_laitage.ToString() + "/50 liters of sheep milk";
                    //from.SendMessage (0x84B,"The milk bucket is ready for sheep milk.");
                    ++m_varsaut.m_laitage;
                    m_mobile.Stam = m_mobile.Stam - 20;
                    from.PlaySound(0X4D1);
                    m_varsaut.Name = "Milk Bucket: " + m_varsaut.m_laitage.ToString() + "/50 liters of sheep milk.";
                    from.SendMessage(0x96D, "You obtain 1 liter of sheep milk.");
                }
                else if (m_mobile is Goat)
                {
                    m_varsaut.m_bestiole = 2;
                    //m_varsaut.Name ="Milk Bucket: " + m_varsaut.m_laitage.ToString() + "/50 liters of goat milk";
                    //from.SendMessage (0x84B,"The milk bucket is ready for goat milk.");
                    ++m_varsaut.m_laitage;
                    m_mobile.Stam = m_mobile.Stam - 20;
                    from.PlaySound(0X4D1);
                    m_varsaut.Name = "Milk Bucket: " + m_varsaut.m_laitage.ToString() + "/50 liters of goat milk.";
                    from.SendMessage(0x96D, "You obtain 1 liter of goat milk.");
                }
                else if (m_mobile is Cow)
                {
                    m_varsaut.m_bestiole = 3;
                    //m_varsaut.Name ="Milk Bucket: " + m_varsaut.m_laitage.ToString() + "/50 liters of cow milk";
                    //from.SendMessage (0x84B,"The milk bucket is ready for cow milk.");
                    ++m_varsaut.m_laitage;
                    m_mobile.Stam = m_mobile.Stam - 20;
                    from.PlaySound(0X4D1);
                    m_varsaut.Name = "Milk Bucket: " + m_varsaut.m_laitage.ToString() + "/50 liters of cow milk.";
                    from.SendMessage(0x96D, "You obtain 1 liter of cow milk.");
                }
                else
                {
                    from.SendMessage(0x96D, "You can obtain milk only from sheep, goats or cows!");
                    from.CloseGump(typeof(LaitageHelpGump));
                    from.SendGump(new LaitageHelpGump(from));
                }
            }
            else if (m_mobile != null && (m_varsaut.m_laitage <= 49))
            {
                if (m_mobile.Stam > 3)
                {
                    if ((m_mobile is Cow) && (m_varsaut.m_bestiole == 3))
                    {
                        ++m_varsaut.m_laitage;
                        m_mobile.Stam = m_mobile.Stam - 20;
                        from.PlaySound(0X4D1);
                        m_varsaut.Name = "Milk Bucket: " + m_varsaut.m_laitage.ToString() + "/50 liters of cow milk.";
                        from.SendMessage(0x96D, "You obtain 1 liter of cow milk.");
                    }
                    else if ((m_mobile is Goat) && (m_varsaut.m_bestiole == 2))
                    {
                        ++m_varsaut.m_laitage;
                        m_mobile.Stam = m_mobile.Stam - 20;
                        from.PlaySound(0X4D1);
                        m_varsaut.Name = "Milk Bucket: " + m_varsaut.m_laitage.ToString() + "/50 liters of goat milk.";
                        from.SendMessage(0x96D, "You obtain 1 liter of goat milk.");
                    }
                    else if ((m_mobile is Sheep) && (m_varsaut.m_bestiole == 1))
                    {
                        ++m_varsaut.m_laitage;
                        m_mobile.Stam = m_mobile.Stam - 20;
                        from.PlaySound(0X4D1);
                        m_varsaut.Name = "Milk Bucket: " + m_varsaut.m_laitage.ToString() + "/50 liters of sheep milk.";
                        from.SendMessage(0x96D, "You obtain 1 liter of sheep milk.");
                    }
                    else
                    {
                        from.SendMessage(0x84B, "You can't obtain milk from that!");
                        from.CloseGump(typeof(LaitageHelpGump));
                        from.SendGump(new LaitageHelpGump(from));
                    }
                }
                else
                {
                    from.SendMessage(0x84B, "This animal is too tired to give more milk!");
                }
            }
            else if ((o is Bottle) && (m_varsaut.m_laitage > 0) && pack.ConsumeTotal(typeof(Bottle), 1))
            {
                if (m_varsaut.m_bestiole == 3)
                {
                    m_varsaut.m_laitage = m_varsaut.m_laitage - 1;
                    from.SendMessage(0x96D, "You fill a bottle with cow milk.");
                    m_varsaut.Name = "Milk Bucket: " + m_varsaut.m_laitage.ToString() + "/50 liters of cow milk.";
                    from.PlaySound(0X240);
                    from.AddToBackpack(new BottleCowMilk());
                }
                else if (m_varsaut.m_bestiole == 2)
                {
                    m_varsaut.m_laitage = m_varsaut.m_laitage - 1;
                    from.SendMessage(0x96D, "You fill a bottle with goat milk.");
                    from.PlaySound(0X240);
                    m_varsaut.Name = "Milk Bucket: " + m_varsaut.m_laitage.ToString() + "/50 liters of goat milk.";
                    from.AddToBackpack(new BottleGoatMilk());
                }
                else if (m_varsaut.m_bestiole == 1)
                {
                    m_varsaut.m_laitage = m_varsaut.m_laitage - 1;
                    from.SendMessage(0x96D, "You fill a bottle with sheep milk.");
                    m_varsaut.Name = "Milk Bucket: " + m_varsaut.m_laitage.ToString() + "/50 liters of sheep milk.";
                    from.PlaySound(0X240);
                    from.AddToBackpack(new BottleSheepMilk());
                }
                else
                {
                    from.SendMessage(0x84B, "This isn't a bottle or the milk bucket is empty.");
                    from.CloseGump(typeof(LaitageHelpGump));
                    from.SendGump(new LaitageHelpGump(from));
                }

                if (m_varsaut.m_laitage <= 0)
                {
                    m_varsaut.m_bestiole = 0;
                    m_varsaut.Name       = "Milk Bucket: (Empty)";
                }
            }
            else if ((o is BaseBeverage))                 // added by Alari
            {
                BaseBeverage p = (BaseBeverage)o;

                if ((m_varsaut.m_laitage >= p.MaxQuantity) && (p.Quantity == 0))
                {
                    if (m_varsaut.m_bestiole == 3)
                    {
                        p.Content           = BeverageType.Milk;
                        p.Quantity          = p.MaxQuantity;
                        m_varsaut.m_laitage = m_varsaut.m_laitage - p.MaxQuantity;
                        from.SendMessage(0x96D, "You fill the container with cow milk.");
                        m_varsaut.Name = "Milk Bucket: " + m_varsaut.m_laitage.ToString() + "/50 liters of cow milk.";
                        from.PlaySound(0X240);
                    }
                    else if (m_varsaut.m_bestiole == 2)
                    {
                        p.Content           = BeverageType.Milk;
                        p.Quantity          = p.MaxQuantity;
                        m_varsaut.m_laitage = m_varsaut.m_laitage - p.MaxQuantity;
                        from.SendMessage(0x96D, "You fill the container with goat milk.");
                        from.PlaySound(0X240);
                        m_varsaut.Name = "Milk Bucket: " + m_varsaut.m_laitage.ToString() + "/50 liters of goat milk.";
                    }
                    else if (m_varsaut.m_bestiole == 1)
                    {
                        p.Content           = BeverageType.Milk;
                        p.Quantity          = p.MaxQuantity;
                        m_varsaut.m_laitage = m_varsaut.m_laitage - p.MaxQuantity;
                        from.SendMessage(0x96D, "You fill the container with sheep milk.");
                        m_varsaut.Name = "Milk Bucket: " + m_varsaut.m_laitage.ToString() + "/50 liters of sheep milk.";
                        from.PlaySound(0X240);
                    }
                    else
                    {
                        from.SendMessage(0x84B, "This isn't a drink container, drink container has liquid in it already, or the milk bucket doesn't have enough milk left in it.");
                        from.CloseGump(typeof(LaitageHelpGump));
                        from.SendGump(new LaitageHelpGump(from));
                    }
                }

                if (m_varsaut.m_laitage <= 0)
                {
                    m_varsaut.m_laitage  = 0;
                    m_varsaut.m_bestiole = 0;
                    m_varsaut.Name       = "Milk Bucket: (Empty)";
                }
            }

            else if (o is CheeseForm)               // added by Alari
            {
                CheeseForm m_MouleVar = (CheeseForm)o;

                if (m_varsaut.m_laitage >= 15 && m_MouleVar.m_MoulePlein == false)
                {
                    m_varsaut.m_laitage = m_varsaut.m_laitage - 15;

                    if (m_varsaut.m_bestiole == 1)
                    {
                        m_varsaut.Name          = "Milk Bucket: " + m_varsaut.m_laitage.ToString() + "/50 liters of sheep milk.";
                        m_MouleVar.m_FromAfaire = 1;
                        m_MouleVar.Name         = "Cheese form - Sheep cheese";
                        m_MouleVar.m_MoulePlein = true;
                    }
                    else if (m_varsaut.m_bestiole == 2)
                    {
                        m_varsaut.Name          = "Milk Bucket: " + m_varsaut.m_laitage.ToString() + "/50 liters of goat milk.";
                        m_MouleVar.m_FromAfaire = 2;
                        m_MouleVar.Name         = "Cheese form - Goat cheese";
                        m_MouleVar.m_MoulePlein = true;
                    }
                    else if (m_varsaut.m_bestiole == 3)
                    {
                        m_varsaut.Name          = "Milk Bucket: " + m_varsaut.m_laitage.ToString() + "/50 liters of cow milk.";
                        m_MouleVar.m_FromAfaire = 3;
                        m_MouleVar.Name         = "Cheese form - Cow cheese";
                        m_MouleVar.m_MoulePlein = true;
                    }
                    else
                    {
                        from.SendMessage(0x84C, "This milk bucket is bad.");
                        from.CloseGump(typeof(CheeseFormHelpGump));
                        from.SendGump(new CheeseFormHelpGump(from));
                    }

                    if (m_varsaut.Laitage <= 0)
                    {
                        m_varsaut.m_bestiole = 0;
                        m_varsaut.Name       = "This milk bucket is empty";
                    }
                }
                else
                {
                    from.SendMessage(0x84C, "The milk bucket didn't contain enough milk.");
                    from.CloseGump(typeof(CheeseFormHelpGump));
                    from.SendGump(new CheeseFormHelpGump(from));
                }
            }

            else
            {
                from.CloseGump(typeof(LaitageHelpGump));
                from.SendGump(new LaitageHelpGump(from));
            }
        }
Example #32
0
        public virtual void Fill_OnTarget(Mobile from, object targ)
        {
            if (!IsEmpty || !Fillable || !ValidateUse(from, false))
            {
                return;
            }

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

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

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

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

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

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

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

                src = (item as IWaterSource);

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

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

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

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

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

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

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

                PlayerMobile player = from as PlayerMobile;

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

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

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

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

                            if (contains)
                            {
                                Delete();

                                player.SendLocalizedMessage(1055035);                                   // You dip the container into the disgusting swamp water, collecting enough for the Hag's vile stew.
                                obj.Complete();
                            }
                        }
                    }
                }
            }
        }
Example #33
0
		public void Pour(Mobile from, BaseBeverage bev)
		{
            if (!bev.IsEmpty && bev.Pourable && bev.Content == BeverageType.Water && bev.ValidateUse(from, false))
            {
                if (m_Stage == EggStage.Burnt)
                    from.SendMessage("You decide not to water the burnt egg.");
                else if (m_WaterLevel < (int)m_Stage)
                {
                    bev.Quantity--;

                    m_WaterLevel++;
                    from.PlaySound(0x4E);

                    InvalidateProperties();
                }
                else
                    from.SendMessage("You decide not to water the egg since it doesn't need it.");
            }
		}
Example #34
0
        public virtual void Fill_OnTarget(Mobile from, object targ)
        {
            if (!IsEmpty || !Fillable || !ValidateUse(from, false))
            {
                return;
            }

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

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

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

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

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

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

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

                src = item as IWaterSource;

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

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

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

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

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

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

                if (cow.TryMilk(from))
                {
                    Content  = BeverageType.Milk;
                    Quantity = MaxQuantity;
                    from.SendLocalizedMessage(1080197);   // You fill the container with milk.
                }
            }
        }
Example #35
0
        // Scriptiz : permet de remplir son pichet à partir de staticTarget ou de StaticItem
        private static bool FillFromStaticWaterSource(Mobile from, BaseBeverage b, int staticId)
        {
            if (!b.IsEmpty || !b.Fillable || !b.ValidateUse(from, false))
                return false;

            if (from == null) return false;
            if (b == null) return false;

            b.Poison = null;
            b.Poisoner = null;

            int randomSeed = Utility.Random(1, 100);

            // water barrels
            if (staticId == 5453 || staticId == 3707)
            {
                b.Quantity = (b.MaxQuantity < 5 ? b.MaxQuantity : 5);

                if (Utility.Random(100) <= 5)
                    b.Poison = Poison.Lesser;
            }
            // water trough
            else if (staticId >= 2881 && staticId <= 2884)
            {
                if (randomSeed <= 10)
                    b.Poison = Poison.Lesser;
            }
            // water tiles & waterfalls
            else if ((staticId >= 6038 && staticId <= 6066) || (staticId >= 13422 && staticId <= 13525) || (staticId >= 13549 && staticId <= 13608))
            {
                if (randomSeed <= 20)
                {
                    if (randomSeed <= 5)
                        b.Poison = Poison.Regular;
                    else
                        b.Poison = Poison.Lesser;
                }
            }
            // fountains
            else if ((staticId >= 5937 && staticId <= 5978) || (staticId >= 6595 && staticId <= 6636))
            {
                if (randomSeed <= 20)
                {
                    if (randomSeed <= 5)
                        b.Poison = Poison.Regular;
                    else
                        b.Poison = Poison.Lesser;
                }
            }
            // swamp tiles (disactivated)
            //else if (staticId >= 12809 && staticId <= 12933)
            //{
            //    if (randomSeed <= 50)
            //        b.Poison = Poison.Regular;
            //    else if (randomSeed <= 80)
            //        b.Poison = Poison.Greater;
            //    else if (randomSeed <= 100)
            //        b.Poison = Poison.Deadly;
            //}
            else
            {
                b.Quantity = 0;
                return false;
            }

            // Fill the beverage
            b.Content = BeverageType.Water;
            if (staticId != 5453 && staticId != 3707) b.Quantity = b.MaxQuantity;

            from.PlaySound(0x2D6);
            return true;
        }
Example #36
0
        public void OnTarget(Mobile from, object obj)
        {
            // TODO: Need details on how oil cloths should get consumed here

            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
            else if (obj is Item && ((Item)obj).RootParent != from)
            {
                from.SendLocalizedMessage(1005425); // You may only wipe down items you are holding or carrying.
            }
            else if (obj is BaseWeapon)
            {
                BaseWeapon weapon = (BaseWeapon)obj;

                if (weapon.Poison == null || weapon.PoisonCharges <= 0)
                {
                    from.LocalOverheadMessage(Network.MessageType.Regular, 0x3B2, 1005422); // Hmmmm... this does not need to be cleaned.
                }
                else
                {
                    if (weapon.PoisonCharges < 2)
                    {
                        weapon.PoisonCharges = 0;
                    }
                    else
                    {
                        weapon.PoisonCharges -= 2;
                    }

                    if (weapon.PoisonCharges > 0)
                    {
                        from.SendLocalizedMessage(1005423); // You have removed some of the caustic substance, but not all.
                    }
                    else
                    {
                        from.SendLocalizedMessage(1010497); // You have cleaned the item.
                    }
                }
            }
            else if (obj == from && obj is PlayerMobile)
            {
                PlayerMobile pm = (PlayerMobile)obj;

                if (pm.BodyMod == 183 || pm.BodyMod == 184)
                {
                    pm.SavagePaintExpiration = TimeSpan.Zero;

                    pm.BodyMod = 0;
                    pm.HueMod  = -1;

                    from.SendLocalizedMessage(1040006); // You wipe away all of your body paint.

                    Consume();
                }
                else
                {
                    from.LocalOverheadMessage(Network.MessageType.Regular, 0x3B2, 1005422); // Hmmmm... this does not need to be cleaned.
                }
            }
            else if (obj is DyeTub)
            {
                DyeTub tub = (DyeTub)obj;

                if (!tub.Redyable)
                {
                    tub.Redyable = true;
                    tub.Charges  = 0;
                    tub.DyedHue  = 0;
                    from.SendMessage("Vous nettoyez le bac de teinture");

                    Consume();
                }
            }

            #region Firebomb
            else if (obj is BaseBeverage)
            {
                BaseBeverage beverage = (BaseBeverage)obj;

                if (beverage.Content == BeverageType.Liquor)
                {
                    Firebomb bomb = new Firebomb(beverage.ItemID);
                    bomb.Name = beverage.Name;

                    beverage.ReplaceWith(bomb);

                    from.SendLocalizedMessage(1060580); // You prepare a firebomb.
                    Consume();
                }
            }
            else if (obj is Firebomb)
            {
                from.SendLocalizedMessage(1060579); // That is already a firebomb!
            }
            #endregion
            else
            {
                from.SendLocalizedMessage(1005426); // The cloth will not work on that.
            }
        }
Example #37
0
        public virtual void Pour_OnTarget(Mobile from, object targ)
        {
            if (IsEmpty || !Pourable || !ValidateUse(from, false))
            {
                return;
            }

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

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

                if (bev.IsFull && bev.Content == this.Content)
                {
                    from.SendLocalizedMessage(500848);                       // Couldn't pour it there.  It was already full.
                }
                else if (!bev.IsEmpty)
                {
                    from.SendLocalizedMessage(500846);                       // Can't pour it there.
                }
                else
                {
                    bev.Content  = this.Content;
                    bev.Poison   = this.Poison;
                    bev.Poisoner = this.Poisoner;

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

                    from.PlaySound(0x4E);
                }
            }
            else if (from == targ)
            {
                // increase characters thirst value based on type of drink // WIZARD
                if (from.Thirst < 20)
                {
                    switch (this.Content)
                    {
                    case BeverageType.Water: from.Thirst += 5; break;

                    case BeverageType.Milk: from.Thirst += 4; break;

                    case BeverageType.Ale: from.Thirst += 3; break;

                    case BeverageType.Wine: from.Thirst += 2; break;

                    case BeverageType.Cider: from.Thirst += 3; break;

                    case BeverageType.Liquor: from.Thirst += 1; break;
                    }
                    // Send message to character about their current thirst value
                    int iThirst = from.Thirst;
                    if (iThirst < 5)
                    {
                        from.SendMessage("You take a drink but are still extremely thirsty");
                    }
                    else if (iThirst < 10)
                    {
                        from.SendMessage("You take a drink and feel less thirsty");
                    }
                    else if (iThirst < 15)
                    {
                        from.SendMessage("You take a drink and feel much less thirsty");
                    }
                    else
                    {
                        from.SendMessage("You take a drink and are no longer thirsty");
                    }

                    Server.Items.DrinkingFunctions.DrinkBenefits(from);
                }
                else
                {
                    from.Thirst = 20;
                }

                if (ContainsAlchohol)
                {
                    int bac = 0;

                    switch (this.Content)
                    {
                    case BeverageType.Ale: bac = 1; break;

                    case BeverageType.Wine: bac = 2; break;

                    case BeverageType.Cider: bac = 3; break;

                    case BeverageType.Liquor: bac = 4; break;
                    }

                    from.BAC += bac;

                    if (from.BAC > 60)
                    {
                        from.BAC = 60;
                    }

                    CheckHeaveTimer(from);
                }

                from.PlaySound(Utility.RandomList(0x30, 0x2D6));

                if (m_Poison != null)
                {
                    from.ApplyPoison(m_Poisoner, m_Poison);
                }

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

                if ((!this.IsEmpty || this.Content == BeverageType.Water) && bwc.Items.Count == 0)
                {
                    int It_Needs = Math.Min((bwc.MaxQuantity - bwc.Quantity), Quantity);

                    if (It_Needs > 0 && (!IsEmpty && !bwc.IsFull))
                    {
                        bwc.Quantity += It_Needs;
                        Quantity     -= It_Needs;

                        from.PlaySound(0x4E);
                    }
                }
            }
            else if (targ is PlantItem)
            {
                ((PlantItem)targ).Pour(from, this);
            }
            else
            {
                from.SendLocalizedMessage(500846);                   // Can't pour it there.
            }
        }