Exemple #1
0
        public override void OnComponentUsed(AddonComponent component, Mobile from)
        {
            BaseHouse house = BaseHouse.FindHouseAt(this);

            if (!from.InRange(component.Location, 3))
            {
                from.SendLocalizedMessage(500332); // I am too far away to do that.
            }
            else if (house != null && from is PlayerMobile)
            {
                if (house.IsOwner(from))
                {
                    if (!from.HasGump(typeof(AuctionBidGump)))
                    {
                        from.SendGump(new AuctionOwnerGump((PlayerMobile)from, this));
                    }
                }
                else if (Auction != null)
                {
                    if (house.HasSecureAccess(from, Level))
                    {
                        if (Auction.InClaimPeriod)
                        {
                            if (Auction.HighestBid != null && from == Auction.HighestBid.Mobile)
                            {
                                Auction.ClaimPrize(from);
                            }
                            else
                            {
                                if (!from.HasGump(typeof(AuctionBidGump)))
                                {
                                    from.SendGump(new AuctionBidGump((PlayerMobile)from, this));
                                }
                            }
                        }
                        else
                        {
                            if (!from.HasGump(typeof(AuctionBidGump)))
                            {
                                from.SendGump(new AuctionBidGump((PlayerMobile)from, this));
                            }
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1156447); // This auction is private.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1156432); // There is no active auction to complete this action.
                }
            }
        }
Exemple #2
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            base.OnResponse(state, info);

            Mobile from = state.Mobile;

            switch (info.ButtonID)
            {
            case 1:
            {
                if (Auction.CheckModifyAuction(User, true))
                {
                    if (Auction.AuctionItem != null)
                    {
                        if (Auction.AuctionItem.LabelNumber != 0)
                        {
                            from.SendLocalizedMessage(1152339, string.Format("#{0}", Auction.AuctionItem.LabelNumber));         // A reward of ~1_ITEM~ has been placed in your backpack.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1152339, Auction.AuctionItem.Name);         // A reward of ~1_ITEM~ has been placed in your backpack.
                        }

                        Auction.AuctionItem.Movable = true;
                        from.AddToBackpack(Auction.AuctionItem);
                        Auction.AuctionItem = null;
                    }

                    from.Target = new InternalTarget(Auction, this);
                }
                else
                {
                    Refresh();
                }
                break;
            }

            case 2:
            {
                if (Auction.CheckModifyAuction(User))
                {
                    TextRelay relay = info.GetTextEntry(1);
                    string    str   = null;

                    if (relay != null)
                    {
                        str = relay.Text;
                    }

                    if (str != null || Guilds.BaseGuildGump.CheckProfanity(str, 140))
                    {
                        Auction.Description = Utility.FixHtml(str.Trim());
                    }
                    else
                    {
                        from.SendLocalizedMessage(1150315);         // That text is unacceptable.
                    }
                }

                Refresh();
                break;
            }

            case 3:
            {
                if (Auction.CheckModifyAuction(User))
                {
                    Auction.Duration = 60;
                }

                Refresh();
                break;
            }

            case 4:
            {
                if (Auction.CheckModifyAuction(User))
                {
                    Auction.Duration = 4320;
                }

                Refresh();
                break;
            }

            case 5:
            {
                if (Auction.CheckModifyAuction(User))
                {
                    Auction.Duration = 7200;
                }

                Refresh();
                break;
            }

            case 6:
            {
                if (Auction.CheckModifyAuction(User))
                {
                    Auction.Duration = 10080;
                }

                Refresh();
                break;
            }

            case 7:
            {
                if (Auction.CheckModifyAuction(User))
                {
                    TextRelay relay1 = info.GetTextEntry(2);

                    string plat1 = null;
                    string gold1 = null;

                    if (relay1 != null)
                    {
                        plat1 = relay1.Text;
                    }

                    relay1 = info.GetTextEntry(3);

                    if (relay1 != null)
                    {
                        gold1 = relay1.Text;
                    }

                    long platAmnt = Utility.ToInt64(plat1);
                    long goldAmnt = Utility.ToInt64(gold1);

                    if (platAmnt >= 0 && goldAmnt >= 0)
                    {
                        _TempBid += platAmnt * Account.CurrencyThreshold;
                        _TempBid += goldAmnt;
                    }
                    else
                    {
                        from.SendLocalizedMessage(1150315);         // That text is unacceptable.
                        _NoBid = true;
                    }

                    if (!_NoBid)
                    {
                        if (Auction.OnGoing && Auction.BidHistory == null)
                        {
                            Auction.CurrentBid = _TempBid;
                        }

                        Auction.StartBid = _TempBid;
                    }
                }

                Refresh();
                break;
            }

            case 8:
            {
                if (Auction.CheckModifyAuction(User))
                {
                    TextRelay relay2 = info.GetTextEntry(4);

                    string plat2 = null;
                    string gold2 = null;

                    if (relay2 != null)
                    {
                        plat2 = relay2.Text;
                    }

                    relay2 = info.GetTextEntry(5);

                    if (relay2 != null)
                    {
                        gold2 = relay2.Text;
                    }

                    long platAmnt2 = Utility.ToInt64(plat2);
                    long goldAmnt2 = Utility.ToInt64(gold2);

                    if (platAmnt2 >= 0 && goldAmnt2 >= 0)
                    {
                        _TempBuyout += platAmnt2 * Account.CurrencyThreshold;
                        _TempBuyout += goldAmnt2;
                    }
                    else
                    {
                        from.SendLocalizedMessage(1150315);         // That text is unacceptable.
                    }

                    Auction.Buyout = _TempBuyout;
                }

                Refresh();
                break;
            }

            case 9:
            {
                if (Auction.StartBid <= 0)
                {
                    User.SendLocalizedMessage(1156434);         // You must set a starting bid.
                }
                else
                {
                    Auction.OnBegin();
                }

                Refresh();
                break;
            }

            case 23:
            {
                if (Auction.OnGoing && Auction.HighestBid == null)
                {
                    Auction.ClaimPrize(User);
                }

                break;
            }
            }
        }