예제 #1
0
        public void OnDecayed()
        {
            Map map = this.Map;

            if (map == null)
            {
                return;
            }

            MultiComponentList mcl   = Components;
            IPooledEnumerable  eable = map.GetObjectsInBounds(new Rectangle2D(X + mcl.Min.X, Y + mcl.Min.Y, mcl.Width, mcl.Height));

            ArrayList del = new ArrayList();

            foreach (object o in eable)
            {
                if (o is Guildstone)
                {
                    if (Contains((Item)o))
                    {
                        del.Add(o);
                    }
                }
                else if (o is StrongBox)
                {
                    del.Add(o);
                }
                else if (o is PlayerVendor)
                {
                    if (Contains((Mobile)o))
                    {
                        del.Add(o);
                    }
                }
                else if (o is BaseHouse)
                {
                    ((BaseHouse)o).Z = this.Z;
                }
            }
            eable.Free();

            for (int i = 0; i < del.Count; i++)
            {
                object o = del[i];
                if (o is PlayerVendor)
                {
                    PlayerVendor v = (PlayerVendor)o;
                    v.Say(503235);                       // I regret nothing!postal
                    v.Blessed = false;
                    v.Kill();
                    v.Delete();
                }
                else if (o is Item)
                {
                    ((Item)o).Delete();
                }
            }
        }
예제 #2
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            if (!m_Vendor.CanInteractWith(from, false))
            {
                return;
            }

            if (m_Vendor.IsOwner(from))
            {
                m_Vendor.SayTo(from, 503212);                 // You own this shop, just take what you want.
                return;
            }

            if (info.ButtonID == 1)
            {
                m_Vendor.Say(from.Name);

                if (!m_VI.Valid || !m_VI.Item.IsChildOf(m_Vendor.Backpack))
                {
                    m_Vendor.SayTo(from, 503216);                     // You can't buy that.
                }
                else if (!Banker.WithdrawPackAndBank(from, m_Vendor.TypeOfCurrency, m_VI.Price))
                {
                    m_Vendor.SayTo(from, 503205);                     // You cannot afford this item.
                }
                else if (!from.PlaceInBackpack(m_VI.Item))
                {
                    m_Vendor.SayTo(from, 503204);                     // You do not have room in your backpack for this.

                    BankBox box = from.FindBank(m_Vendor.Expansion) ?? from.BankBox;

                    box.Credit += (ulong)m_VI.Price;
                    m_Vendor.SayTo(from, "I credited your bank account.  Please come back when you have room for this item.");
                }
                else
                {
                    from.SendLocalizedMessage(503201);                     // You take the item.
                    m_Vendor.HoldCurrency += m_VI.Price;
                    m_Vendor.LastActivity  = DateTime.UtcNow;
                    m_Vendor.NameMod       = null;
                    m_Vendor.NameHue       = -1;
                }
            }
            else
            {
                from.SendLocalizedMessage(503207);                 // Cancelled purchase.
            }
        }
예제 #3
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (m_Vendor.Deleted)
            {
                return;
            }

            Mobile from = state.Mobile;

            from.CloseGump(typeof(PlayerVendorBuyGump));

            if (info.ButtonID == 2)
            {
                if (m_VI.IsForSale && m_Item.RootParent == m_Vendor)
                {
                    m_Vendor.Say(from.Name);

                    Container pack = from.Backpack;

                    if ((pack != null && pack.ConsumeTotal(typeof(Gold), m_VI.Price)) || from.BankBox.ConsumeTotal(typeof(Gold), m_VI.Price))
                    {
                        int price = m_VI.Price;
                        m_Vendor.HoldGold += price;
                        m_Vendor.RemoveInfo(m_Item);

                        if (pack == null || !pack.TryDropItem(from, m_Item, false))
                        {
                            m_Vendor.SayTo(from, 503204);                             // You do not have room in your backpack for this.
                            m_Item.MoveToWorld(from.Location, from.Map);
                        }

                        // charge our N% commission AFTER the customer gets their goods (in case the comission charge causes the vendor to die.)
                        if (m_Vendor.PricingModel == PricingModel.Commission)
                        {
                            m_Vendor.Charge((int)(price * m_Vendor.Commission), PlayerVendor.ChargeReason.Commission);
                        }
                    }
                    else
                    {
                        m_Vendor.SayTo(from, 503205);                         // You cannot afford this item.
                    }
                }
                else
                {
                    m_Vendor.SayTo(from, 503216);                     // You can't buy that.
                }
            }
        }
예제 #4
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (m_Vendor.Deleted)
            {
                return;
            }

            Mobile from = state.Mobile;

            from.CloseGump(typeof(PlayerVendorBuyGump));

            if (info.ButtonID == 2)
            {
                if (m_VI.IsForSale && m_Item.RootParent == m_Vendor)
                {
                    m_Vendor.Say(from.Name);

                    Container pack = from.Backpack;

                    if ((pack != null && pack.ConsumeTotal(typeof(Gold), m_VI.Price)) || from.BankBox.ConsumeTotal(typeof(Gold), m_VI.Price))
                    {
                        m_Vendor.HoldGold += m_VI.Price;
                        m_Vendor.RemoveInfo(m_Item);

                        if (pack == null || !pack.TryDropItem(from, m_Item, false))
                        {
                            m_Vendor.SayTo(from, 503204);                               // You do not have room in your backpack for this.
                            m_Item.MoveToWorld(from.Location, from.Map);
                        }
                    }
                    else
                    {
                        m_Vendor.SayTo(from, 503205);                           // You cannot afford this item.
                    }
                }
                else
                {
                    m_Vendor.SayTo(from, 503216);                       // You can't buy that.
                }
            }
        }
예제 #5
0
        public override void OnResponse(Network.NetState sender, RelayInfo info)
        {
            if (info.ButtonID == 2)
            {
                PlayerVendor pv = m_Book.RootParent as PlayerVendor;

                if (m_Book.Entries.Contains(m_Object) && pv != null)
                {
                    int price = 0;

                    VendorItem vi = pv.GetVendorItem(m_Book);

                    if (vi != null && !vi.IsForSale)
                    {
                        if (m_Object is BOBLargeEntry)
                        {
                            price = ((BOBLargeEntry)m_Object).Price;
                        }
                        else if (m_Object is BOBSmallEntry)
                        {
                            price = ((BOBSmallEntry)m_Object).Price;
                        }
                    }

                    if (price != m_Price)
                    {
                        pv.SayTo(m_From, "The price has been been changed. If you like, you may offer to purchase the item again.");
                    }
                    else if (price == 0)
                    {
                        pv.SayTo(m_From, 1062382); // The deed selected is not available.
                    }
                    else
                    {
                        Item item = null;

                        if (m_Object is BOBLargeEntry)
                        {
                            item = ((BOBLargeEntry)m_Object).Reconstruct();
                        }
                        else if (m_Object is BOBSmallEntry)
                        {
                            item = ((BOBSmallEntry)m_Object).Reconstruct();
                        }

                        if (item == null)
                        {
                            m_From.SendMessage("Internal error. The bulk order deed could not be reconstructed.");
                        }
                        else
                        {
                            pv.Say(m_From.Name);

                            Container pack = m_From.Backpack;

                            if ((pack == null) || ((pack != null) && (!pack.CheckHold(m_From, item, true, true, 0, item.PileWeight + item.TotalWeight))))
                            {
                                pv.SayTo(m_From, 503204); // You do not have room in your backpack for this
                                m_From.SendGump(new BOBGump(m_From, m_Book, m_Page, null));
                            }
                            else
                            {
                                if ((pack != null && pack.ConsumeTotal(typeof(Gold), price)) || Banker.Withdraw(m_From, price))
                                {
                                    m_Book.Entries.Remove(m_Object);
                                    m_Book.InvalidateProperties();
                                    pv.HoldGold += price;
                                    m_From.AddToBackpack(item);
                                    m_From.SendLocalizedMessage(1045152); // The bulk order deed has been placed in your backpack.

                                    if (m_Book.Entries.Count / 5 < m_Book.ItemCount)
                                    {
                                        m_Book.ItemCount--;
                                        m_Book.InvalidateItems();
                                    }

                                    if (m_Book.Entries.Count > 0)
                                    {
                                        m_From.SendGump(new BOBGump(m_From, m_Book, m_Page, null));
                                    }
                                    else
                                    {
                                        m_From.SendLocalizedMessage(1062381); // The book is empty.
                                    }
                                }
                                else
                                {
                                    pv.SayTo(m_From, 503205); // You cannot afford this item.
                                    item.Delete();
                                }
                            }
                        }
                    }
                }
                else
                {
                    if (pv == null)
                    {
                        m_From.SendLocalizedMessage(1062382); // The deed selected is not available.
                    }
                    else
                    {
                        pv.SayTo(m_From, 1062382); // The deed selected is not available.
                    }
                }
            }
            else
            {
                m_From.SendLocalizedMessage(503207); // Cancelled purchase.
            }
        }
예제 #6
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            if (!m_Vendor.CanInteractWith(from, false))
            {
                return;
            }

            if (m_Vendor.IsOwner(from))
            {
                m_Vendor.SayTo(from, 503212);                   // You own this shop, just take what you want.
                return;
            }

            if (info.ButtonID == 1)
            {
                m_Vendor.Say(from.Name);

                if (!m_VI.Valid || !m_VI.Item.IsChildOf(m_Vendor.Backpack))
                {
                    m_Vendor.SayTo(from, 503216);                       // You can't buy that.
                    return;
                }

                int totalGold = 0;

                if (from.Backpack != null)
                {
                    totalGold += from.Backpack.GetAmount(typeof(Gold));
                }

                totalGold += Banker.GetBalance(from);

                if (totalGold < m_VI.Price)
                {
                    m_Vendor.SayTo(from, 503205);                       // You cannot afford this item.
                }
                else if (!from.PlaceInBackpack(m_VI.Item))
                {
                    m_Vendor.SayTo(from, 503204);                       // You do not have room in your backpack for this.
                }
                else
                {
                    int leftPrice = m_VI.Price;

                    if (from.Backpack != null)
                    {
                        leftPrice -= from.Backpack.ConsumeUpTo(typeof(Gold), leftPrice);
                    }

                    if (leftPrice > 0)
                    {
                        Banker.Withdraw(from, leftPrice);
                    }

                    m_Vendor.HoldGold += m_VI.Price;

                    from.SendLocalizedMessage(503201);                       // You take the item.
                }
            }
            else
            {
                from.SendLocalizedMessage(503207);                   // Cancelled purchase.
            }
        }
        public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            if (info.ButtonID == 2)
            {
                PlayerVendor pv = m_Book.RootParent as PlayerVendor;

                if (m_Book.Entries.Contains(m_Object) && pv != null)
                {
                    int price = 0;

                    VendorItem vi = pv.GetVendorItem(m_Book);

                    if (vi != null && !vi.IsForSale)
                    {
                        if (m_Object is PowerScrollBookEntry)
                        {
                            price = ((PowerScrollBookEntry)m_Object).Price;
                        }
                    }

                    if (price != m_Price)
                    {
                        pv.SayTo(m_From, "The price has been been changed. If you like, you may offer to purchase the item again.");
                    }
                    else if (price == 0)
                    {
                        pv.SayTo(m_From, 1062382);
                    }
                    else
                    {
                        Item item = null;

                        if (m_Object is PowerScrollBookEntry)
                        {
                            item = ((PowerScrollBookEntry)m_Object).Reconstruct();
                        }

                        if (item == null)
                        {
                            m_From.SendMessage("Internal error. The power scroll could not be reconstructed.");
                        }
                        else
                        {
                            pv.Say(m_From.Name);

                            Container pack = m_From.Backpack;

                            if ((pack != null && pack.ConsumeTotal(typeof(Gold), price)) || Banker.Withdraw(m_From, price))
                            {
                                m_Book.Entries.Remove(m_Object);
                                m_Book.InvalidateProperties();

                                pv.HoldGold += price;

                                if (m_From.AddToBackpack(item))
                                {
                                    m_From.SendMessage("The power scroll has been placed in your backpack.");
                                }
                                else
                                {
                                    pv.SayTo(m_From, 503204);
                                }

                                if (m_Book.Entries.Count > 0)
                                {
                                    m_From.SendGump(new PowerScrollBookGump(m_From, m_Book));
                                }
                                else
                                {
                                    m_From.SendLocalizedMessage(1062381);
                                }
                            }
                            else
                            {
                                pv.SayTo(m_From, 503205);
                                item.Delete();
                            }
                        }
                    }
                }
                else
                {
                    if (pv == null)
                    {
                        m_From.SendLocalizedMessage(1062382);
                    }
                    else
                    {
                        pv.SayTo(m_From, 1062382);
                    }
                }
            }
            else
            {
                m_From.SendLocalizedMessage(503207);
            }
        }
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            if (!m_Vendor.CanInteractWith(from, false))
            {
                return;
            }

            if (m_Vendor.IsOwner(from))
            {
                m_Vendor.SayTo(from, "Voce e o dono deste Shop, pegue o que quiser");                   // You own this shop, just take what you want.
                return;
            }

            if (info.ButtonID == 1)
            {
                m_Vendor.Say(from.Name);

                if (!m_VI.Valid || !m_VI.Item.IsChildOf(m_Vendor.Backpack))
                {
                    m_Vendor.SayTo(from, "Voce nao pode comprar isto");                       // You can't buy that.
                    return;
                }

                int totalGold = 0;

                if (from.Backpack != null)
                {
                    totalGold += from.Backpack.GetAmount(typeof(Gold));
                }

                totalGold += Banker.GetBalance(from);

                if (totalGold < m_VI.Price)
                {
                    m_Vendor.SayTo(from, "Voce nao tem dinheiro!");                       // You cannot afford this item.
                }
                else if (!from.PlaceInBackpack(m_VI.Item))
                {
                    m_Vendor.SayTo(from, "Voce nao tem espaco na sua backpack");                       // You do not have room in your backpack for this.
                }
                else
                {
                    int leftPrice = m_VI.Price;

                    if (from.Backpack != null)
                    {
                        leftPrice -= from.Backpack.ConsumeUpTo(typeof(Gold), leftPrice);
                    }

                    if (leftPrice > 0)
                    {
                        Banker.Withdraw(from, leftPrice);
                    }

                    m_Vendor.HoldGold += m_VI.Price;

                    from.SendMessage("Voce comprou o item");                       // You take the item.
                }
            }
            else
            {
                from.SendMessage("Voce cancelou a compra"); // Cancelled purchase.
            }
        }
예제 #9
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (info.ButtonID == 2)
            {
                PlayerVendor pv = m_Book.RootParent as PlayerVendor;

                if (pv != null)
                {
                    int price = 0;

                    VendorItem vi = pv.GetVendorItem(m_Book);

                    if (vi != null && !vi.IsForSale)
                    {
                        price = m_Recipe.Price;
                    }

                    if (price != m_Price)
                    {
                        pv.SayTo(m_From, 1150158); // The price of the selected item has been changed from the value you confirmed. You must select and confirm the purchase again at the new price in order to buy it.
                        m_Book.Using = false;
                    }
                    else if (m_Recipe.Amount == 0 || price == 0)
                    {
                        pv.SayTo(m_From, 1158821); // The recipe selected is not available.
                        m_Book.Using = false;
                    }
                    else
                    {
                        Item item = new RecipeScroll(m_Recipe.RecipeID);

                        pv.Say(m_From.Name);

                        Container pack = m_From.Backpack;

                        if ((pack != null && pack.ConsumeTotal(typeof(Gold), price)) || Banker.Withdraw(m_From, price))
                        {
                            m_Book.Recipes.ForEach(x =>
                            {
                                if (x.RecipeID == m_Recipe.RecipeID)
                                {
                                    x.Amount = x.Amount - 1;
                                }
                            });

                            m_Book.InvalidateProperties();

                            pv.HoldGold += price;

                            if (m_From.AddToBackpack(item))
                            {
                                m_From.SendLocalizedMessage(1158820); // The recipe has been placed in your backpack.
                            }
                            else
                            {
                                pv.SayTo(m_From, 503204); // You do not have room in your backpack for this.
                            }
                            m_From.SendGump(new RecipeBookGump(m_From, m_Book));
                        }
                        else
                        {
                            pv.SayTo(m_From, 503205); // You cannot afford this item.
                            item.Delete();
                            m_Book.Using = false;
                        }
                    }
                }
                else
                {
                    m_Book.Using = false;

                    if (pv == null)
                    {
                        m_From.SendLocalizedMessage(1158821); // The recipe selected is not available.
                    }
                    else
                    {
                        pv.SayTo(m_From, 1158821); // The recipe selected is not available.
                    }
                }
            }
            else
            {
                m_Book.Using = false;
                m_From.SendLocalizedMessage(503207); // Cancelled purchase.
            }
        }
예제 #10
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            if (!m_Vendor.CanInteractWith(from, false))
            {
                return;
            }

            if (m_Vendor.IsOwner(from))
            {
                m_Vendor.SayTo(from, 503212);                   // You own this shop, just take what you want.
                return;
            }

            if (info.ButtonID == 1)
            {
                m_Vendor.Say(from.Name);

                if (!m_VI.Valid || !m_VI.Item.IsChildOf(m_Vendor.Backpack))
                {
                    m_Vendor.SayTo(from, 503216);                       // You can't buy that.
                    return;
                }

                int totalGold = 0;
                int price     = m_VI.GetPrice(from, m_Vendor);

                Item[] items = from.Backpack.FindItemsByType(typeof(Gold), true);

                for (int i = 0; i < items.Length; ++i)
                {
                    Item item = items[i];
                    if (item.LootType != LootType.Newbied && item.Movable)
                    {
                        totalGold += items[i].Amount;
                    }
                }

                //if ( from.Backpack != null )
                //	totalGold += from.Backspack.GetAmount( typeof( Gold ) );

                totalGold += Banker.GetBalance(from);

                if (totalGold < price)
                {
                    m_Vendor.SayTo(from, 503205);                       // You cannot afford this item.
                }
                else if (!from.PlaceInBackpack(m_VI.Item))
                {
                    m_Vendor.SayTo(from, 503204);                       // You do not have room in your backpack for this.
                }
                else
                {
                    int leftPrice = price;

                    if (from.Backpack != null)
                    {
                        leftPrice -= from.Backpack.ConsumeUpTo(typeof(Gold), leftPrice);
                    }

                    if (leftPrice > 0)
                    {
                        Banker.Withdraw(from, leftPrice);
                    }

                    m_Vendor.HoldGold += price;
                    from.SendLocalizedMessage(503201);                       // You take the item.
                }
            }
            else
            {
                from.SendLocalizedMessage(503207);                   // Cancelled purchase.
            }
        }