Beispiel #1
0
        public void Enhance()
        {
            for (int i = Items.Count - 1; i >= 0 && m_Charges > 0; i--)
            {
                Bandage bandage = Items[i] as Bandage;

                if (bandage != null)
                {
                    if (bandage.Amount > m_Charges)
                    {
                        bandage.Amount -= m_Charges;
                        DropItem(new EnhancedBandage(m_Charges));
                        m_Charges = 0;
                    }
                    else
                    {
                        DropItem(new EnhancedBandage(bandage.Amount));
                        m_Charges -= bandage.Amount;
                        bandage.Delete();
                    }

                    InvalidateProperties();
                }
            }
        }
Beispiel #2
0
        public void Enhance(Mobile from)
        {
            EnhancedBandage existing = null;

            foreach (Item item in Items)
            {
                if (item is EnhancedBandage)
                {
                    existing = item as EnhancedBandage;
                    break;
                }
            }

            for (int i = this.Items.Count - 1; i >= 0 && this.m_Charges > 0; --i)
            {
                if (this.Items[i] is EnhancedBandage)
                {
                    continue;
                }

                Bandage bandage = this.Items[i] as Bandage;

                if (bandage != null)
                {
                    Item enhanced;

                    m_NextUse = DateTime.UtcNow + TimeSpan.FromDays(1);

                    if (bandage.Amount > this.m_Charges)
                    {
                        bandage.Amount -= this.m_Charges;
                        enhanced        = new EnhancedBandage(this.m_Charges);
                        this.m_Charges  = 0;
                    }
                    else
                    {
                        enhanced        = new EnhancedBandage(bandage.Amount);
                        this.m_Charges -= bandage.Amount;
                        bandage.Delete();
                    }

                    if (from == null || !this.TryDropItem(from, enhanced, false))
                    {
                        if (existing != null)
                        {
                            existing.StackWith(from, enhanced);
                        }
                        else
                        {
                            this.DropItem(enhanced);
                        }
                    }
                }
            }

            this.InvalidateProperties();
        }
Beispiel #3
0
        public void Enhance(Mobile from)
        {
            EnhancedBandage existing = null;

            foreach (Item item in Items)
            {
                if (item is EnhancedBandage)
                {
                    existing = item as EnhancedBandage;
                    break;
                }
            }

            for (int i = Items.Count - 1; i >= 0 && m_Charges > 0; --i)
            {
                if (Items[i] is EnhancedBandage)
                {
                    continue;
                }

                Bandage bandage = Items[i] as Bandage;

                if (bandage != null)
                {
                    Item enhanced;

                    if (bandage.Amount > m_Charges)
                    {
                        bandage.Amount -= m_Charges;
                        enhanced        = new EnhancedBandage(m_Charges);
                        m_Charges       = 0;
                    }
                    else
                    {
                        enhanced   = new EnhancedBandage(bandage.Amount);
                        m_Charges -= bandage.Amount;
                        bandage.Delete();
                    }

                    // try stacking first
                    if (from == null || !TryDropItem(from, enhanced, false))
                    {
                        if (existing != null)
                        {
                            existing.StackWith(from, enhanced);
                        }
                        else
                        {
                            DropItem(enhanced);
                        }
                    }
                }
            }

            InvalidateProperties();
        }
        public void Enhance(Mobile from)
        {
            for (int i = this.Items.Count - 1; i >= 0 && this.m_Charges > 0; --i)
            {
                if (this.Items[i] is EnhancedBandage)
                {
                    continue;
                }

                Bandage bandage = this.Items[i] as Bandage;

                if (bandage != null)
                {
                    Item enhanced;

                    if (bandage.Amount > this.m_Charges)
                    {
                        bandage.Amount -= this.m_Charges;
                        enhanced        = new EnhancedBandage(this.m_Charges);
                        this.m_Charges  = 0;
                    }
                    else
                    {
                        enhanced        = new EnhancedBandage(bandage.Amount);
                        this.m_Charges -= bandage.Amount;
                        bandage.Delete();
                    }

                    if (from == null || !this.TryDropItem(from, enhanced, false)) // try stacking first
                    {
                        this.DropItem(enhanced);
                    }
                }
            }

            this.InvalidateProperties();
        }