コード例 #1
0
        public override void OnResponse(RelayInfo info)
        {
            switch (info.ButtonID)
            {
            case 0: return;

            case 1:
                if (_Month == 1)
                {
                    _Month = 12;
                }
                else
                {
                    _Month--;
                }
                break;

            case 2:
                if (_Month == 12)
                {
                    _Month = 1;
                }
                else
                {
                    _Month++;
                }
                break;

            case 3:
                if (_Day == 1)
                {
                    _Day = GetDaysInMonth(_Month);
                }
                else
                {
                    _Day--;
                }
                break;

            case 4:
                if (_Day == GetDaysInMonth(_Month))
                {
                    _Day = 1;
                }
                else
                {
                    _Day++;
                }
                break;

            case 5:
                if (_Duration == 1)
                {
                    _Duration = 1;
                }
                else
                {
                    _Duration--;
                }

                _Duration = Math.Min(365, _Duration);
                break;

            case 6:
                _Duration++;
                break;

            case 7:
                if (_Status == EventStatus.Inactive)
                {
                    _Status = EventStatus.Seasonal;
                }
                else
                {
                    _Status--;
                }
                break;

            case 8:
                if (_Status == EventStatus.Seasonal)
                {
                    _Status = EventStatus.Inactive;
                }
                else
                {
                    _Status++;
                }
                break;

            case 9:
                Entry.MonthStart = _Month;
                Entry.DayStart   = _Day;
                Entry.Status     = _Status;

                TextRelay relay = info.GetTextEntry(0);

                if (relay != null && !string.IsNullOrEmpty(relay.Text))
                {
                    var duration = Utility.ToInt32(relay.Text);

                    if (duration > 0)
                    {
                        _Duration = Math.Min(365, duration);
                    }
                }

                Entry.Duration = _Duration;

                BaseGump.SendGump(new SeasonalEventGump(User));

                return;

            case 10:
                BaseGump.SendGump(new SeasonalEventGump(User));
                return;
            }

            Refresh();
        }
コード例 #2
0
ファイル: SeedBox.cs プロジェクト: Tauriella/ServUO-1
        public bool TryAddSeed(Mobile from, Seed seed, int index = -1)
        {
            if (!from.Backpack.CheckHold(from, seed, true, true) || seed.Amount <= 0)
            {
                return(false);
            }
            else if (!from.InRange(this.GetWorldLocation(), 3) || from.Map != this.Map)
            {
                return(false);
            }
            else if (TotalCount + seed.Amount <= MaxSeeds)
            {
                SeedEntry entry    = GetExisting(seed);
                int       oldcount = UniqueCount;

                if (entry != null)
                {
                    entry.Seed.Amount += seed.Amount;
                    seed.Delete();

                    entry.Seed.InvalidateProperties();
                }
                else if (UniqueCount < MaxUnique)
                {
                    entry = new SeedEntry(seed);
                    DropItem(seed);

                    seed.Movable = false;
                    seed.InvalidateProperties();
                }
                else
                {
                    from.SendLocalizedMessage(1151839); // There is not enough room in the box.
                }

                if (entry != null)
                {
                    if (Entries.Contains(entry))
                    {
                        if (index > -1 && index < Entries.Count - 1)
                        {
                            Entries.Remove(entry);
                            AddEntry(entry, index);
                        }
                    }
                    else
                    {
                        if (index > -1 && index < Entries.Count)
                        {
                            AddEntry(entry, index);
                        }
                        else
                        {
                            AddEntry(entry);
                        }
                    }

                    from.SendLocalizedMessage(1151846); // You put the seed in the seedbox.

                    if (from is PlayerMobile)
                    {
                        var gump = new SeedBoxGump((PlayerMobile)from, this);
                        gump.CheckPage(entry);

                        BaseGump.SendGump(gump);
                    }

                    InvalidateProperties();
                    return(true);
                }
            }
            else
            {
                from.SendLocalizedMessage(1151839); // There is not enough room in the box.
            }

            return(false);
        }
コード例 #3
0
            public override void OnResponse(RelayInfo info)
            {
                switch (info.ButtonID)
                {
                case 1:
                    if (RemoveFromBracelet)
                    {
                        GreaterBraceletOfBinding bracelet = User.FindItemOnLayer(Layer.Bracelet) as GreaterBraceletOfBinding;

                        if (bracelet != null && bracelet.Friends[Index] != null)
                        {
                            var entry = bracelet.Friends[Index];

                            if (entry.Bracelet is GreaterBraceletOfBinding)
                            {
                                PlayerMobile             pm  = entry.Mobile;
                                GreaterBraceletOfBinding gbr = entry.Bracelet as GreaterBraceletOfBinding;

                                gbr.Remove(User);

                                if (pm != null && pm.NetState != null)
                                {
                                    var gump = pm.FindGump <GreaterBraceletOfBindingGump>();

                                    if (gump != null)
                                    {
                                        gump.Refresh();
                                    }
                                }
                            }

                            bracelet.Remove(entry.Mobile);
                            BaseGump.SendGump(new GreaterBraceletOfBindingGump(User, bracelet));
                        }
                    }
                    else
                    {
                        BraceletOfBinding brac = User.FindItemOnLayer(Layer.Bracelet) as BraceletOfBinding;

                        if (brac != null)
                        {
                            var entry = new BindEntry(User, brac);
                            Bracelet.Add(entry, Index);

                            var g = From.FindGump <GreaterBraceletOfBindingGump>();

                            if (g != null)
                            {
                                g.Refresh();
                            }

                            if (brac is GreaterBraceletOfBinding && !((GreaterBraceletOfBinding)brac).IsBound(From))
                            {
                                entry = new BindEntry(From, Bracelet);
                                ((GreaterBraceletOfBinding)brac).Pending = entry;

                                BaseGump.SendGump(new GreaterBraceletOfBindingGump(User, (GreaterBraceletOfBinding)brac, entry));
                            }
                            else
                            {
                                brac.Bound = Bracelet;
                            }
                        }
                        else
                        {
                            User.SendLocalizedMessage(1151772);     // You must be wearing this item to bind to another character.
                            From.SendLocalizedMessage(1151771);     // The target player must be wearing a Bracelet of Binding or Greater Bracelet of Binding for the device to work.
                        }
                    }
                    break;

                case 2:
                    if (!RemoveFromBracelet)
                    {
                        From.SendLocalizedMessage(1151778, User.Name);     // ~1_val~ has declined your request to bind bracelets.
                    }
                    break;
                }
            }
コード例 #4
0
ファイル: UltimaStore.cs プロジェクト: Evad-lab/ServUOX
        public static void TryPurchase(Mobile m)
        {
            var cart  = GetCart(m);
            var total = GetSubTotal(cart);

            if (cart == null || cart.Count == 0 || total == 0)
            {
                // Purchase failed due to your cart being empty.
                m.SendLocalizedMessage(1156842);
            }
            else if (total > GetCurrency(m, true))
            {
                if (m is PlayerMobile)
                {
                    BaseGump.SendGump(new NoFundsGump((PlayerMobile)m));
                }
            }
            else
            {
                var subtotal = 0;
                var fail     = false;

                var remove = new List <StoreEntry>();

                foreach (var entry in cart)
                {
                    for (var i = 0; i < entry.Value; i++)
                    {
                        if (!entry.Key.Construct(m))
                        {
                            fail = true;

                            try
                            {
                                using (var op = File.AppendText("UltimaStoreError.log"))
                                {
                                    op.WriteLine("Bad Constructor: {0}", entry.Key.ItemType.Name);

                                    Utility.WriteConsoleColor(ConsoleColor.Red, "[Ultima Store]: Bad Constructor: {0}", entry.Key.ItemType.Name);
                                }
                            }
                            catch
                            { }
                        }
                        else
                        {
                            remove.Add(entry.Key);

                            subtotal += entry.Key.Cost;
                        }
                    }
                }

                if (subtotal > 0)
                {
                    DeductCurrency(m, subtotal);
                }

                var profile = GetProfile(m);

                foreach (var entry in remove)
                {
                    profile.RemoveFromCart(entry);
                }

                if (fail)
                {
                    // Failed to process one of your items. Please check your cart and try again.
                    m.SendLocalizedMessage(1156853);
                }
            }
        }
コード例 #5
0
ファイル: CityStone.cs プロジェクト: travismills82/TrueUO
        public override void GetContextMenuEntries(Mobile from, List <ContextMenuEntry> list)
        {
            base.GetContextMenuEntries(from, list);

            if (!CityLoyaltySystem.Enabled || City == null)
            {
                return;
            }

            if (!City.IsCitizen(from))
            {
                if (City.Herald != null)
                {
                    City.Herald.SayTo(from, 1154061, City.Definition.Name); // Only citizens of ~1_CITY~ may use the City Stone!
                }
                else
                {
                    from.SendLocalizedMessage(1154061, City.Definition.Name); // Only citizens of ~1_CITY~ may use the City Stone!
                }
                return;
            }

            list.Add(new SimpleContextMenuEntry(from, 1154018, m => // Grant Citizen Title
            {
                if (City.IsGovernor(m))
                {
                    m.SendLocalizedMessage(1154027);     // Which Citizen do you wish to bestow a title?
                    m.BeginTarget(10, false, TargetFlags.None, (mob, targeted) =>
                    {
                        if (targeted is PlayerMobile pm)
                        {
                            if (City.IsCitizen(pm))
                            {
                                BaseGump.SendGump(new PlayerTitleGump(mob as PlayerMobile, pm, City));
                            }
                            else
                            {
                                mob.SendLocalizedMessage(1154029);         // You may only bestow a title on citizens of this city!
                            }
                        }
                        else
                        {
                            mob.SendLocalizedMessage(1154028);         // You can only bestow a title on a player!
                        }
                    });
                }
            }, enabled: City.IsGovernor(from)));

            list.Add(new SimpleContextMenuEntry(from, 1154031, m => // Open Trade Deal
            {
                if (City.IsGovernor(m))
                {
                    BaseGump.SendGump(new ChooseTradeDealGump(m as PlayerMobile, City));
                }
            }, enabled: City.IsGovernor(from)));

            list.Add(new SimpleContextMenuEntry(from, 1154277, m => // Open Inventory WTF is this?
            {
                if (m is PlayerMobile mobile && City.IsGovernor(mobile))
                {
                    BaseGump.SendGump(new OpenInventoryGump(mobile, City));
                }
            }, enabled: City.IsGovernor(from)));
コード例 #6
0
            public override void OnResponse(RelayInfo info)
            {
                if (info.ButtonID == 0)
                {
                    return;
                }

                int id = info.ButtonID - 10;

                if (id >= 0 && id < Bracelet.Friends.Length)
                {
                    if (Bracelet.Friends[id] == null)
                    {
                        if (Choose)
                        {
                            Bracelet.Add(Entry, id);
                            Choose = false;

                            Refresh();
                        }
                        else if (!Bracelet.IsFull)
                        {
                            User.BeginTarget(10, false, TargetFlags.None, (from, targeted) =>
                            {
                                if (targeted is PlayerMobile)
                                {
                                    PlayerMobile pm          = targeted as PlayerMobile;
                                    BraceletOfBinding pmBrac = pm.FindItemOnLayer(Layer.Bracelet) as BraceletOfBinding;

                                    if (pm == User)
                                    {
                                        User.SendLocalizedMessage(1151779);     // The bracelet cannot bind with itself.
                                    }
                                    else if (Bracelet.IsBound(pm))
                                    {
                                        User.SendLocalizedMessage(1151770);     // This bracelet is already bound to this character.
                                    }
                                    else if (!User.Items.Contains(Bracelet))
                                    {
                                        User.SendLocalizedMessage(1151772);     // You must be wearing this item to bind to another character.
                                    }
                                    else if (pmBrac == null)
                                    {
                                        User.SendLocalizedMessage(1151771);     // The target player must be wearing a Bracelet of Binding or Greater Bracelet of Binding for the device to work.
                                    }
                                    else if (pm.HasGump(typeof(ConfirmBindGump)) || (pmBrac is GreaterBraceletOfBinding && ((GreaterBraceletOfBinding)pmBrac).Pending != null))
                                    {
                                        User.SendLocalizedMessage(1151833);     // You may not get confirmation from this player at this time.
                                    }
                                    else if ((pmBrac is GreaterBraceletOfBinding && ((GreaterBraceletOfBinding)pmBrac).IsFull) || (!(pmBrac is GreaterBraceletOfBinding) && pmBrac.Bound != null))
                                    {
                                        User.SendLocalizedMessage(1151781);     // The target player's greater bracelet of binding is full.
                                    }
                                    else
                                    {
                                        User.SendLocalizedMessage(1151777, pm.Name);     // Waiting for ~1_val~ to respond.
                                        Refresh();

                                        BaseGump.SendGump(new ConfirmBindGump(pm, User, id, Bracelet, false));
                                    }
                                }
                                else
                                {
                                    User.SendLocalizedMessage(1151775);     // You may not bind your bracelet to that.
                                }
                            });
                        }
                    }
                    else
                    {
                        Bracelet.Bound = Bracelet.Friends[id].Bracelet;
                        Bracelet.Activate(User);
                    }
                }
                else
                {
                    id = info.ButtonID - 100;

                    if (id >= 0 && id < Bracelet.Friends.Length && Bracelet.Friends[id] != null)
                    {
                        BaseGump.SendGump(new ConfirmBindGump(User, Bracelet.Friends[id].Mobile, id, Bracelet.Friends[id].Bracelet as GreaterBraceletOfBinding, true));
                    }
                }
            }
コード例 #7
0
 public static void CompleteQuest(PlayerMobile pm, BaseQuest quest)
 {
     BaseGump.SendGump(new TownCrierQuestCompleteGump(pm, quest));
 }
コード例 #8
0
 public static void CompleteQuest(PlayerMobile pm, object title, object body, int gumpID)
 {
     BaseGump.SendGump(new TownCrierQuestCompleteGump(pm, title, body, gumpID));
 }
コード例 #9
0
        public override void GetContextMenuEntries(Mobile from, List <ContextMenuEntry> list)
        {
            base.GetContextMenuEntries(from, list);

            if (!CityLoyaltySystem.Enabled || City == null)
            {
                return;
            }

            if (!City.IsCitizen(from))
            {
                if (City.Herald != null)
                {
                    City.Herald.SayTo(from, 1154061, City.Definition.Name); // Only citizens of ~1_CITY~ may use the City Stone!
                }
                else
                {
                    from.SendLocalizedMessage(1154061, City.Definition.Name); // Only citizens of ~1_CITY~ may use the City Stone!
                }
                return;
            }

            list.Add(new SimpleContextMenuEntry(from, 1154018, m => // Grant Citizen Title
            {
                if (City.IsGovernor(m))
                {
                    m.SendLocalizedMessage(1154027);     // Which Citizen do you wish to bestow a title?
                    m.BeginTarget(10, false, TargetFlags.None, (mob, targeted) =>
                    {
                        PlayerMobile pm = targeted as PlayerMobile;

                        if (pm != null)
                        {
                            if (City.IsCitizen(pm))
                            {
                                BaseGump.SendGump(new PlayerTitleGump(mob as PlayerMobile, pm, City));
                            }
                            else
                            {
                                mob.SendLocalizedMessage(1154029);         // You may only bestow a title on citizens of this city!
                            }
                        }
                        else
                        {
                            mob.SendLocalizedMessage(1154028);         // You can only bestow a title on a player!
                        }
                    });
                }
            }, enabled: City.IsGovernor(from)));

            list.Add(new SimpleContextMenuEntry(from, 1154031, m => // Open Trade Deal
            {
                if (City.IsGovernor(m))
                {
                    BaseGump.SendGump(new ChooseTradeDealGump(m as PlayerMobile, City));
                }
            }, enabled: City.IsGovernor(from)));

            list.Add(new SimpleContextMenuEntry(from, 1154277, m => // Open Inventory WTF is this?
            {
                if (m is PlayerMobile && City.IsGovernor(m))
                {
                    BaseGump.SendGump(new OpenInventoryGump((PlayerMobile)m, City));
                }
            }, enabled: City.IsGovernor(from)));

            list.Add(new SimpleContextMenuEntry(from, 1154278, m => // Place Ballot Box
            {
                if (City.IsGovernor(m))
                {
                    if (Boxes != null && Boxes.Count >= CityLoyaltySystem.MaxBallotBoxes)
                    {
                        m.SendMessage("You have reached the maximum amount of ballot boxes in your city.");
                        return;
                    }

                    m.SendMessage("Where would you like to place a ballot box?");
                    m.BeginTarget(3, true, TargetFlags.None, (mob, targeted) =>
                    {
                        if (targeted is IPoint3D)
                        {
                            IPoint3D p = targeted as IPoint3D;
                            Spells.SpellHelper.GetSurfaceTop(ref p);
                            BallotBox box = new BallotBox();

                            if (CheckLocation(m, box, p))
                            {
                                box.Owner   = m;
                                box.Movable = false;

                                if (Boxes == null)
                                {
                                    Boxes = new List <BallotBox>();
                                }

                                Boxes.Add(box);
                                box.MoveToWorld(new Point3D(p), Map);

                                m.SendMessage("{0} of {1} ballot boxes placed.", Boxes.Count.ToString(), CityLoyaltySystem.MaxBallotBoxes.ToString());
                            }
                            else
                            {
                                box.Delete();
                            }
                        }
                    });
                }
            }, enabled: City.IsGovernor(from)));

            list.Add(new SimpleContextMenuEntry(from, 1154060, m => // Utilize Trade Deal
            {
                City.TryUtilizeTradeDeal(from);
            }, enabled: City.ActiveTradeDeal != TradeDeal.None));

            CityLoyaltyEntry entry = City.GetPlayerEntry <CityLoyaltyEntry>(from);

            list.Add(new SimpleContextMenuEntry(from, 1154019, m => // Remove City Title
            {
                if (entry != null && entry.CustomTitle != null)
                {
                    entry.CustomTitle = null;

                    if (m is PlayerMobile)
                    {
                        ((PlayerMobile)m).RemoveRewardTitle(1154017, true);
                    }

                    m.SendMessage("City Title removed.");
                }
            }, enabled: entry != null && entry.CustomTitle != null));

            list.Add(new SimpleContextMenuEntry(from, 1154068, m => // Accept Office
            {
                if (m is PlayerMobile && m == City.GovernorElect && City.Governor == null)
                {
                    BaseGump.SendGump(new AcceptOfficeGump(m as PlayerMobile, City));
                }
            }, enabled: City.GovernorElect == from && City.Governor == null && City.GetLoyaltyRating(from) >= LoyaltyRating.Unknown));
        }
コード例 #10
0
ファイル: Gump.cs プロジェクト: uotools/runuogdk
 private int CompareZ(BaseGump a, BaseGump b)
 {
     return(b.Z.CompareTo(a.Z));
 }
コード例 #11
0
        public override void OnResponse(RelayInfo info)
        {
            if (info.ButtonID != 0)
            {
                if (!VendorSearch.CanSearch(User))
                {
                    User.SendLocalizedMessage(1154680); //Before using vendor search, you must be in a justice region or a safe log-out location (such as an inn or a house which has you on its Owner, Co-owner, or Friends list).
                    return;
                }

                TextRelay searchname = info.GetTextEntry(1);

                if (searchname != null && !String.IsNullOrEmpty(searchname.Text))
                {
                    string text = searchname.Text.Trim();

                    if (Criteria.SearchName == null || text.ToLower() != Criteria.SearchName.ToLower())
                    {
                        Criteria.SearchName = searchname.Text;
                    }
                }
            }

            switch (info.ButtonID)
            {
            case 0: break;

            case 1:     // Search
            {
                User.CloseGump(typeof(SearchResultsGump));

                if (Criteria.IsEmpty)
                {
                    BaseGump.SendGump(new VendorSearchGump(User, 1154586));         // Please select some criteria to search for.
                }
                else
                {
                    var resultsTask = FindVendorItemsAsync(User, Criteria);

                    var pollingTimer = new TaskPollingTimer <List <SearchItem> >(resultsTask, (results) =>
                        {
                            User.CloseGump(typeof(SearchWaitGump));

                            if (results == null || results.Count == 0)
                            {
                                BaseGump.SendGump(new VendorSearchGump(User, 1154587));     // No items matched your search.
                            }
                            else
                            {
                                Refresh(true);
                                BaseGump.SendGump(new SearchResultsGump(User, results));
                            }
                        });

                    resultsTask.Start();
                    pollingTimer.Start();

                    BaseGump.SendGump(new SearchWaitGump(User, pollingTimer));
                }
                break;
            }

            case 2:     // Clear Criteria
            {
                Criteria.Reset();
                Refresh(true);
                break;
            }

            case 4:     // Nothing, resend gump
                Refresh(true);
                break;

            case 7:     // remove item name
                Criteria.SearchName = null;
                Refresh(true);
                break;

            case 8:     // remove price entry
                Criteria.EntryPrice = false;
                Refresh(true);
                break;

            case 236:     // Low to High
                Criteria.SortBy = SortBy.LowToHigh;
                Refresh(true);
                break;

            case 237:     // High to Low
                Criteria.SortBy = SortBy.HighToLow;
                Refresh(true);
                break;

            case 1154512:     // Set Min/Max price
                TextRelay tr1 = info.GetTextEntry(7);
                TextRelay tr2 = info.GetTextEntry(8);

                if (tr1 != null && tr1.Text != null)
                {
                    string text = tr1.Text.Trim();
                    int    min  = 0;

                    if (int.TryParse(text, out min))
                    {
                        Criteria.MinPrice = min;
                    }
                }

                if (tr2 != null && tr2.Text != null)
                {
                    string text = tr2.Text.Trim();
                    int    max  = 0;

                    if (int.TryParse(text, out max))
                    {
                        Criteria.MaxPrice = max;
                    }
                }

                Criteria.EntryPrice = true;
                Refresh(true);
                break;

            default:
                if (info.ButtonID > 1000)
                {
                    SearchDetail toRemove = Criteria.Details[info.ButtonID - 1001];

                    if (toRemove.Category == Category.Equipment)
                    {
                        Criteria.SearchType = Layer.Invalid;
                    }

                    Criteria.Details.Remove(toRemove);
                    Refresh(true);
                }
                else
                {
                    if (Criteria.Details.Count >= 20)
                    {
                        BaseGump.SendGump(new VendorSearchGump(User, 1154681));     // You may not add any more search criteria items.
                    }

                    var    criteria = SearchCriteriaCategory.AllCategories.SelectMany(x => x.Criteria, (x, c) => new { x.Category, c.Object, c.Cliloc, c.PropCliloc }).ToList()[info.ButtonID - 50];
                    object o        = criteria.Object;
                    int    value    = 0;

                    TextRelay valuetext = info.GetTextEntry(info.ButtonID - 40);

                    if (valuetext != null)
                    {
                        value = Math.Max(o is AosAttribute && (AosAttribute)o == AosAttribute.CastSpeed ? -1 : 0, Utility.ToInt32(valuetext.Text));
                    }

                    Criteria.TryAddDetails(o, criteria.Cliloc, criteria.PropCliloc, value, criteria.Category);
                    Refresh(true);
                }
                break;
            }
        }
コード例 #12
0
ファイル: PetBrokerGumps.cs プロジェクト: vsemchenkov/ServUO
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            if (info.ButtonID == 1) // Main Menu
            {
                from.SendGump(new PetInventoryGump(m_Broker, from));
            }
            else if (info.ButtonID < 200) // LORE
            {
                int id = info.ButtonID - 100;

                if (id >= 0 && id < m_Entries.Count)
                {
                    PetBrokerEntry entry = m_Entries[id];

                    if (entry != null && entry.Pet != null && m_Broker.BrokerEntries.Contains(entry))
                    {
                        from.SendGump(new PetInventoryGump(m_Broker, from));

                        if (from is PlayerMobile)
                        {
                            Timer.DelayCall(TimeSpan.FromSeconds(1), () =>
                            {
                                BaseGump.SendGump(new NewAnimalLoreGump((PlayerMobile)from, entry.Pet));
                            });
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1150368); // The selected animal is not available.
                    }
                }
            }
            else if (info.ButtonID < 300) // VIEW
            {
                int id = info.ButtonID - 200;

                if (id >= 0 && id < m_Entries.Count)
                {
                    PetBrokerEntry entry = m_Entries[id];

                    if (entry != null && entry.Pet != null && m_Broker.BrokerEntries.Contains(entry) && entry.Pet.IsStabled)
                    {
                        BaseCreature pet = entry.Pet;

                        pet.Blessed = true;
                        pet.SetControlMaster(m_Broker);
                        pet.ControlTarget = m_Broker;
                        pet.ControlOrder  = OrderType.None;
                        pet.MoveToWorld(m_Broker.Location, m_Broker.Map);
                        pet.IsStabled = false;
                        pet.Home      = pet.Location;
                        pet.RangeHome = 2;
                        pet.Loyalty   = BaseCreature.MaxLoyalty;

                        PetBroker.AddToViewTimer(pet);
                        from.SendLocalizedMessage(1150369, String.Format("{0}\t{1}", entry.TypeName, pet.Name)); // The ~1_TYPE~ named "~2_NAME~" is now in the animal broker's pen for inspection.
                    }
                    else
                    {
                        from.SendLocalizedMessage(1150368); // The selected animal is not available.
                    }
                }

                from.SendGump(new PetInventoryGump(m_Broker, from));
            }
            else // BUY
            {
                int id = info.ButtonID - 300;

                if (id >= 0 && id < m_Entries.Count)
                {
                    PetBrokerEntry entry = m_Entries[id];

                    if (entry != null && entry.Pet != null && m_Broker.BrokerEntries.Contains(entry))
                    {
                        from.SendGump(new ConfirmBuyPetGump(m_Broker, entry));
                    }
                }
            }
        }
コード例 #13
0
        public override void OnResponse(RelayInfo info)
        {
            int id = info.ButtonID;

            switch (id)
            {
            case 0: break;

            case 1:
            case 2:
            case 3:
            case 4:
            {
                Category = (GumpCategory)id;
                Refresh();
                break;
            }

            case 5:     // <<
            {
                Page = 0;
                Refresh();
                break;
            }

            case 6:     // <
            {
                Page = Math.Max(0, Page - 1);
                Refresh();
                break;
            }

            case 7:     // >
            {
                Page = Math.Min(Pages, Page + 1);
                Refresh();
                break;
            }

            case 8:     // >>
            {
                Page = Pages;
                Refresh();
                break;
            }

            case 9:     // Learn More - EM Page
            {
                User.LaunchBrowser(TownCryerSystem.EMEventsPage);
                Refresh();
                break;
            }

            case 10:     //UOSI
            {
                City = City.Monitor;
                Refresh();
                break;
            }

            case 11:
            {
                City = City.Fawn;
                Refresh();
                break;
            }

            case 12:
            {
                City = City.Moonshade;
                Refresh();
                break;
            }

            case 13:
            {
                // City = City.Moonglow;
                Refresh();
                break;
            }

            case 14:
            {
                // City = City.NewMagincia;
                Refresh();
                break;
            }

            case 15:
            {
                // City = City.SkaraBrae;
                Refresh();
                break;
            }

            case 16:
            {
                // City = City.Trinsic;
                Refresh();
                break;
            }

            case 17:
            {
                // City = City.Vesper;
                Refresh();
                break;
            }

            case 18:
            {
                //City = City.Yew;
                Refresh();
                break;
            }

            default:
            {
                if (id < 200)
                {
                    id -= 100;

                    if (id >= 0 && id < TownCryerSystem.NewsEntries.Count)
                    {
                        BaseGump.SendGump(new TownCryerNewsGump(User, Cryer, TownCryerSystem.NewsEntries[id]));
                    }
                }
                else if (id < 300)
                {
                    id -= 200;

                    if (id >= 0 && id < TownCryerSystem.ModeratorEntries.Count)
                    {
                        BaseGump.SendGump(new TownCryerEventModeratorGump(User, Cryer, TownCryerSystem.ModeratorEntries[id]));
                    }
                }
                else if (id < 400)
                {
                    id -= 300;

                    if (id >= 0 && id < TownCryerSystem.CityEntries.Count)
                    {
                        BaseGump.SendGump(new TownCryerCityGump(User, Cryer, TownCryerSystem.CityEntries[id]));
                    }
                }
                else if (id < 600)
                {
                    id -= 400;

                    if (id >= 0 && id < TownCryerSystem.GuildEntries.Count)
                    {
                        BaseGump.SendGump(new TownCryerGuildGump(User, Cryer, TownCryerSystem.GuildEntries[id]));
                    }
                }
                else if (id < 3000)
                {
                    if (id < 2500)
                    {
                        id -= 2000;

                        if (id >= 0 && id < TownCryerSystem.ModeratorEntries.Count)
                        {
                            BaseGump.SendGump(new CreateEMEntryGump(User, Cryer, TownCryerSystem.ModeratorEntries[id]));
                        }
                    }
                    else
                    {
                        id -= 2500;

                        if (id >= 0 && id < TownCryerSystem.ModeratorEntries.Count)
                        {
                            TownCryerSystem.ModeratorEntries.RemoveAt(id);
                        }

                        Refresh();
                    }
                }
                else if (id < 4000)
                {
                    var city = CityLoyaltySystem.GetCitizenship(User, false);

                    if ((city != null && city.Governor == User) || User.AccessLevel >= AccessLevel.GameMaster)         // Only Governors
                    {
                        if (id < 3500)
                        {
                            id -= 3000;

                            if (id >= 0 && id < TownCryerSystem.CityEntries.Count)
                            {
                                BaseGump.SendGump(new CreateCityEntryGump(User, Cryer, City, TownCryerSystem.CityEntries[id]));
                            }
                        }
                        else
                        {
                            id -= 3500;

                            if (id >= 0 && id < TownCryerSystem.CityEntries.Count)
                            {
                                TownCryerSystem.CityEntries.RemoveAt(id);
                            }
                        }
                    }

                    Refresh();
                }
                else if (id < 5000)
                {
                    if (id < 4500)
                    {
                        id -= 4000;

                        if (id >= 0 && id < TownCryerSystem.GuildEntries.Count)
                        {
                            BaseGump.SendGump(new CreateGuildEntryGump(User, Cryer, TownCryerSystem.GuildEntries[id]));
                        }
                    }
                    else
                    {
                        id -= 4500;

                        if (id >= 0 && id < TownCryerSystem.GuildEntries.Count)
                        {
                            TownCryerSystem.GuildEntries.RemoveAt(id);
                        }

                        Refresh();
                    }
                }
            }

            break;
            }
        }