public static void TryPurchase(Mobile m) { Dictionary <StoreEntry, int> cart = GetCart(m); int 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 { int subtotal = 0; bool fail = false; List <StoreEntry> remove = new List <StoreEntry>(); foreach (KeyValuePair <StoreEntry, int> entry in cart) { for (int i = 0; i < entry.Value; i++) { if (!entry.Key.Construct(m)) { fail = true; try { using (StreamWriter 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 (Exception e) { Diagnostics.ExceptionLogging.LogException(e); } } else { remove.Add(entry.Key); subtotal += entry.Key.Cost; } } } if (subtotal > 0) { DeductCurrency(m, subtotal); } PlayerProfile profile = GetProfile(m); foreach (StoreEntry 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); } } }
private static void HeplerPaulsonCompleteGump_OnCommand(CommandEventArgs e) { BaseGump.SendGump(new HeplerPaulsonCompleteGump(e.Mobile as PlayerMobile)); }
public static void TryRentVault(PlayerMobile pm, AccountVault vault, VaultManager manager) { if (pm != null && pm.Account != null && !HasVault(pm)) { if (vault == null) { vault = FindNearest <AccountVault>(pm, v => v.Account == null); } if (vault != null) { if (!ValidateLocation(vault)) { Utility.WriteConsoleColor(ConsoleColor.Red, "Invalid Account Vault Location: {0} [{1}]", vault.Location.ToString(), vault.Map != null ? vault.Map.ToString() : "null map"); pm.SendMessage("You cannot rent an account vault in this location!"); } else if (!SystemSettings.HasBalance(pm)) { if (manager == null) { manager = FindNearest <VaultManager>(pm); } if (SystemSettings.UseTokens) { if (manager != null) { manager.SayTo(pm, 1158313, 0x3B2); // But thou hast not the vault tokens! Please visit the Ultima Store for more details. } else { pm.SendLocalizedMessage(1158313); // But thou hast not the vault tokens! Please visit the Ultima Store for more details. } var entry = UltimaStore.GetEntry(typeof(VaultToken)); if (entry != null) { BaseGump.SendGump(new PromoItemGump(pm, entry, 0x9CCB)); } } else if (manager != null) { manager.SayTo(pm, 0x3B2, "But thou hast not the gold! You need {0} to rent a vault!", SystemSettings.RentGoldValue.ToString("N0", System.Globalization.CultureInfo.GetCultureInfo("en-US"))); } else { pm.SendMessage("But thou hast not the gold! You need {0} to rent a vault!", SystemSettings.RentGoldValue.ToString("N0", System.Globalization.CultureInfo.GetCultureInfo("en-US"))); } } else { BaseGump.SendGump(new PetTrainingStyleConfirmGump(pm, 1074974, SystemSettings.RentMessage(), () => { if (CanAssignVault(pm, vault)) { vault.TakeOwnership(pm); } })); } } else { // TODO: Message? } } }
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 (PetTrainingHelper.Enabled && from is PlayerMobile) { Timer.DelayCall(TimeSpan.FromSeconds(1), () => { BaseGump.SendGump(new NewAnimalLoreGump((PlayerMobile)from, entry.Pet)); }); } else { from.CloseGump(typeof(Server.SkillHandlers.AnimalLoreGump)); from.SendGump(new Server.SkillHandlers.AnimalLoreGump(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)); } } } }
public static void CompleteQuest(PlayerMobile pm, BaseQuest quest) { BaseGump.SendGump(new TownCrierQuestCompleteGump(pm, quest)); }
public static void CompleteQuest(PlayerMobile pm, object title, object body, int gumpID) { BaseGump.SendGump(new TownCrierQuestCompleteGump(pm, title, body, gumpID)); }
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(); }
public override void OnResponse(RelayInfo info) { int id = info.ButtonID; if (id == 0) { ReleaseHidden(User); return; } var profile = UltimaStore.GetProfile(User); if (id >= 100 && id <= 105) // Change Category { Search = false; var oldCat = profile.Category; profile.Category = (StoreCategory)id - 99; if (oldCat != profile.Category) { StoreList = UltimaStore.GetList(Category); Page = 0; } Refresh(); return; } else if (id == 106) // Promo Code { Refresh(); BaseGump.SendGump(new PromoCodeGump(User, this)); return; } else if (id == 107) // FAQ { if (!String.IsNullOrEmpty(Configuration.CurrencyInfoWebsite)) { User.LaunchBrowser(Configuration.CurrencyInfoWebsite); } else { User.LaunchBrowser("https://uo.com/ultima-store/"); } Refresh(); return; } else if (id >= 108 && id <= 112) // Change Sort Method { var oldSort = profile.SortBy; profile.SortBy = (SortBy)id - 108; if (oldSort != profile.SortBy) { // re-orders the list if (oldSort == SortBy.Newest || oldSort == SortBy.Oldest) { ColUtility.Free(StoreList); StoreList = UltimaStore.GetList(Category); } UltimaStore.SortList(StoreList, profile.SortBy); Page = 0; } Refresh(); return; } else if (id == 113) // Cart View { if (profile != null) { profile.Category = StoreCategory.Cart; } Refresh(); return; } else if (id == 114) // search { TextRelay searchTxt = info.GetTextEntry(0); if (searchTxt != null && !String.IsNullOrEmpty(searchTxt.Text)) { Search = true; SearchText = searchTxt.Text; } else { User.SendLocalizedMessage(1150315); // That text is unacceptable. } Refresh(); return; } else if (id == 115) // Buy { int total = UltimaStore.GetSubTotal(Cart); if (total <= UltimaStore.GetCurrency(User, true)) { BaseGump.SendGump(new ConfirmPurchaseGump(User)); } else { BaseGump.SendGump(new NoFundsGump(User)); } return; } else if (id == 116) // page forward { Page++; Refresh(); return; } else if (id == 117) // page back { Page--; Refresh(); return; } else if (id < 2000) // Add To Cart { Refresh(); var entry = StoreList[id - 1000]; if (Cart == null || Cart.Count < 10) { BaseGump.SendGump(new ConfirmCartGump(User, this, entry)); return; } else { User.SendLocalizedMessage(1156745); // Your store cart is currently full. } } else if (id < 3000) // Change Amount In Cart { Refresh(); var entry = UltimaStore.Entries[id - 2000]; BaseGump.SendGump(new ConfirmCartGump(User, this, entry, Cart != null && Cart.ContainsKey(entry) ? Cart[entry] : 0)); return; } else if (id < 4000) // Remove From Cart { var entry = UltimaStore.Entries[id - 3000]; if (profile != null) { profile.RemoveFromCart(entry); } Refresh(); return; } ReleaseHidden(User); }
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; } }
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); }
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)); } } }
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)));
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)); }
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; } }
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; } }