private void OpenConfig(GumpButton btn) { Minimize(); var p = new PropertiesGump(User, WorldChat.CMOptions) { X = X + btn.X, Y = Y + btn.Y }; User.SendGump(p); }
private void OpenConfig(GumpButton btn) { Minimize(); PropertiesGump p = new PropertiesGump(User, TrashCollection.CMOptions) { X = X + btn.X, Y = Y + btn.Y }; User.SendGump(p); }
private void OpenConfig(GumpButton btn) { Minimize(); PropertiesGump p = new PropertiesGump(User, EquipmentSets.CMOptions) { X = X + btn.X, Y = Y + btn.Y }; User.SendGump(p); }
public override void OnResponse(Server.Network.NetState sender, RelayInfo info) { switch (info.ButtonID) { case 0: case 1: m_Speaker.EndUpdate(); break; case 2: m_User.SendGump(new SpeechEntryGump(m_User, m_Speaker)); break; case 3: m_User.SendGump(new SpeakerGump(m_User, m_Speaker, m_Page - 1)); return; case 4: m_User.SendGump(new SpeakerGump(m_User, m_Speaker, m_Page + 1)); return; case 5: m_User.SendGump(this); PropertiesGump pGump = new PropertiesGump(m_User, m_Speaker); pGump.X = 350; pGump.Y = 50; m_User.SendGump(pGump); return; default: int index = (info.ButtonID - 10) / 2; int action = (info.ButtonID - 10) % 2; // 0 - Edit, 1 - Delete int speechIndex = m_Page * 4 + index; switch (action) { case 0: m_User.SendGump(new SpeechEntryGump(m_User, m_Speaker, (SpeechEntry)m_Speaker.Speech[speechIndex])); break; case 1: m_Speaker.Speech.RemoveAt(speechIndex); m_User.SendGump(new SpeakerGump(m_User, m_Speaker, 0)); return; } break; } base.OnResponse(sender, info); }
protected override void SelectEntry(GumpButton button, BaseTrashHandler entry) { base.SelectEntry(button, entry); var opts = new MenuGumpOptions(); if (User.AccessLevel >= TrashCollection.Access) { opts.AppendEntry( new ListGumpEntry( "Options", b => { Refresh(); var pg = new PropertiesGump(User, Selected) { X = b.X, Y = b.Y }; User.SendGump(pg); }, HighlightHue)); opts.AppendEntry( new ListGumpEntry( "Accept List", b => Send(new TrashHandlerAcceptListGump(User, entry, Hide(true))), HighlightHue)); opts.AppendEntry( new ListGumpEntry( "Ignore List", b => Send(new TrashHandlerIgnoreListGump(User, entry, Hide(true))), HighlightHue)); opts.AppendEntry( new ListGumpEntry( entry.Enabled ? "Disable" : "Enable", b1 => { entry.Enabled = !entry.Enabled; Refresh(true); }, entry.Enabled ? ErrorHue : HighlightHue)); opts.AppendEntry(new ListGumpEntry("Cancel", b => { })); } Send(new MenuGump(User, Refresh(), opts, button)); }
private void InitializePage(int pageNumber) { //The background AddBackground(60, 95, 515, 330, 5054); //Adds see through AddAlphaRegion(60, 95, 515, 330); int startIndex = (pageNumber * m_OptionsPerPage) > m_PropertyList.Length ? m_PropertyList.Length : (pageNumber * m_OptionsPerPage); int endIndex = (startIndex + m_OptionsPerPage) > m_PropertyList.Length ? m_PropertyList.Length : (startIndex + m_OptionsPerPage); for (int i = startIndex; i < endIndex; ++i) { PropertyInfo pI = m_PropertyList[i]; DescriptionAttribute dA = GetDescriptionAttribute(pI); CommandPropertyAttribute cpa = GetCPA(pI); //Field name AddLabelCropped(437, 120 + (((endIndex - 1) - i) * 70), 128, 20, 0x384, pI.Name); //Prop value AddImageTiled(435, 140 + (((endIndex - 1) - i) * 70), 110, 20, 0x0BBC); AddLabelCropped(437, 140 + (((endIndex - 1) - i) * 70), 108, 20, 0, PropertiesGump.ValueToString(m_HairStylist, pI)); //Edit button if (pI.CanWrite && cpa != null && m_From.AccessLevel >= cpa.WriteLevel) { AddButton(550, 142 + (((endIndex - 1) - i) * 70), 0x15E1, 0x15E5, (int)GumpChoice.EditSettings + i, GumpButtonType.Reply, 0); } //Variabel description AddHtml(70, 102 + (((endIndex - 1) - i) * 70), 360, 60, dA.Description, true, false); //Delimiter image AddImageTiled(70, 165 + (((endIndex - 1) - i) * 70), 497, 2, 96); } //Pagination for (int i = 0; i <= (m_PropertyList.Length / m_OptionsPerPage); i++) { //Highlight current page if (i == pageNumber) { AddImageTiled(67 + (i * 25), 387, 25, 25, 0xBBC); } AddButton(70 + (i * 25), 390, 0x8B1 + i, 0x8B1 + i, (int)GumpChoice.SelectPage + i, GumpButtonType.Reply, 0); } }
protected override void SelectEntry(GumpButton button, WorldChatChannel entry) { base.SelectEntry(button, entry); var opts = new MenuGumpOptions(); if (User.AccessLevel >= WorldChat.Access) { opts.AppendEntry( new ListGumpEntry( "Options", b => { Refresh(); var pg = new PropertiesGump(User, Selected) { X = b.X, Y = b.Y }; User.SendGump(pg); }, HighlightHue)); opts.AppendEntry( new ListGumpEntry( entry.Available ? "Disable" : "Enable", b1 => { entry.Available = !entry.Available; Refresh(true); }, entry.Available ? ErrorHue : HighlightHue)); if (!entry.Permanent) { opts.AppendEntry(new ListGumpEntry("Delete", DeleteChannel, ErrorHue)); } opts.AppendEntry(new ListGumpEntry("Cancel", b => { })); } Send(new MenuGump(User, Refresh(), opts, button)); }
protected override void CompileMenuOptions(MenuGumpOptions list) { list.Clear(); if (Selected != null && !Selected.Deleted) { if (User.AccessLevel >= AutoPvP.Access) { list.AppendEntry( new ListGumpEntry( "Edit Options", b => { Minimize(); User.SendGump( new PropertiesGump(User, Selected) { X = b.X, Y = b.Y }); }, HighlightHue)); list.AppendEntry( new ListGumpEntry( "Edit Advanced Options", b => { Minimize(); User.SendGump( new PropertiesGump(User, Selected.Options) { X = b.X, Y = b.Y }); }, HighlightHue)); if (Selected.State == PvPBattleState.Internal) { list.AppendEntry( new ListGumpEntry( "Edit Spectate Region", b => { if (Selected.SpectateRegion == null) { Selected.SpectateRegion = RegionExtUtility.Create <PvPSpectateRegion>(Selected); } Send(new PvPSpectateBoundsGump(User, Selected, Hide(true))); }, HighlightHue)); list.AppendEntry( new ListGumpEntry( "Edit Battle Region", b => { if (Selected.BattleRegion == null) { Selected.BattleRegion = RegionExtUtility.Create <PvPBattleRegion>(Selected); } Send(new PvPBattleBoundsGump(User, Selected, Hide(true))); }, HighlightHue)); } list.AppendEntry( new ListGumpEntry( "Edit Doors", b => Send(new PvPDoorListGump(User, Selected, Hide(true), UseConfirmDialog)), HighlightHue)); list.AppendEntry( new ListGumpEntry( "Edit Description", b => Send( new TextInputPanelGump <PvPBattle>( User, Hide(true), title: "Battle Description (HTML/BBC Supported)", input: Selected.Description, limit: 1000, callback: s => { s = s.ParseBBCode(); if (!String.IsNullOrWhiteSpace(s)) { Selected.Description = s; } Refresh(true); })), HighlightHue)); } list.AppendEntry( new ListGumpEntry( "View Schedule", b => Send(new ScheduleOverviewGump(User, Selected.Schedule, Hide(true))), (User.AccessLevel >= AutoPvP.Access) ? HighlightHue : TextHue)); list.AppendEntry( new ListGumpEntry( "View Teams", b => Send(new PvPTeamListGump(User, Selected, Hide(true))), (User.AccessLevel >= AutoPvP.Access) ? HighlightHue : TextHue)); if (User.AccessLevel >= AutoPvP.Access) { list.AppendEntry( new ListGumpEntry( "View Rules/Restrictions", b => { MenuGumpOptions opts = new MenuGumpOptions(); opts.AppendEntry( new ListGumpEntry( "Inherit Rules/Restrictions", b2 => { MenuGumpOptions opts2 = new MenuGumpOptions(); AutoPvP.Battles.Values.Where(ba => ba != Selected) .ForEach( ba => opts2.AppendEntry( new ListGumpEntry( ba.Name, () => { var rulesA = Selected.Options.Rules; var rulesB = ba.Options.Rules; rulesA.AllowBeneficial = rulesB.AllowBeneficial; rulesA.AllowHarmful = rulesB.AllowHarmful; rulesA.AllowHousing = rulesB.AllowHousing; rulesA.AllowPets = rulesB.AllowPets; rulesA.AllowSpawn = rulesB.AllowSpawn; rulesA.AllowSpeech = rulesB.AllowSpeech; rulesA.CanBeDamaged = rulesB.CanBeDamaged; rulesA.CanDamageEnemyTeam = rulesB.CanDamageEnemyTeam; rulesA.CanDamageOwnTeam = rulesB.CanDamageOwnTeam; rulesA.CanDie = rulesB.CanDie; rulesA.CanHeal = rulesB.CanHeal; rulesA.CanHealEnemyTeam = rulesB.CanHealEnemyTeam; rulesA.CanHealOwnTeam = rulesB.CanHealOwnTeam; rulesA.CanMount = rulesB.CanMount; rulesA.CanMoveThrough = rulesB.CanMoveThrough; rulesA.CanMountEthereal = rulesB.CanMountEthereal; rulesA.CanResurrect = rulesB.CanResurrect; rulesA.CanUseStuckMenu = rulesB.CanUseStuckMenu; Selected.Options.Restrictions.Items.List = new Dictionary <Type, bool>(ba.Options.Restrictions.Items.List); Selected.Options.Restrictions.Pets.List = new Dictionary <Type, bool>(ba.Options.Restrictions.Pets.List); Selected.Options.Restrictions.Spells.List = new Dictionary <Type, bool>(ba.Options.Restrictions.Spells.List); Selected.Options.Restrictions.Skills.List = new Dictionary <int, bool>(ba.Options.Restrictions.Skills.List); Refresh(true); }))); Send(new MenuGump(User, this, opts2, b)); })); opts.AppendEntry( new ListGumpEntry( "Rules", mb => { Refresh(); PropertiesGump g = new PropertiesGump(User, Selected.Options.Rules) { X = mb.X, Y = mb.Y }; User.SendGump(g); })); opts.AppendEntry( new ListGumpEntry( "Items", mb => Send(new PvPRestrictItemsListGump(User, Selected.Options.Restrictions.Items, Hide(true))))); opts.AppendEntry( new ListGumpEntry( "Pets", mb => Send(new PvPRestrictPetsListGump(User, Selected.Options.Restrictions.Pets, Hide(true))))); opts.AppendEntry( new ListGumpEntry( "Skills", mb => Send(new PvPRestrictSkillsListGump(User, Selected.Options.Restrictions.Skills, Hide(true))))); opts.AppendEntry( new ListGumpEntry( "Spells", mb => Send(new PvPRestrictSpellsListGump(User, Selected.Options.Restrictions.Spells, Hide(true))))); Send(new MenuGump(User, this, opts, b)); }, (User.AccessLevel >= AutoPvP.Access) ? HighlightHue : TextHue)); list.AppendEntry( new ListGumpEntry( "Reset Statistics", b => { if (UseConfirmDialog) { Send( new ConfirmDialogGump( User, this, title: "Reset Battle Statistics?", html: "All data associated with the battle statistics will be transferred to player profiles then cleared.\nThis action can not be reversed!\nDo you want to continue?", onAccept: OnConfirmResetStatistics)); } else { OnConfirmResetStatistics(b); } }, HighlightHue)); if (Selected.State == PvPBattleState.Internal) { if (Selected.Validate(User)) { list.AppendEntry( new ListGumpEntry( "Publish", b => { Selected.State = PvPBattleState.Queueing; Refresh(true); }, HighlightHue)); } } else { list.AppendEntry( new ListGumpEntry( "Internalize", b => { Selected.State = PvPBattleState.Internal; Refresh(true); }, HighlightHue)); if (!Selected.Hidden) { if (Selected.Validate(User)) { list.AppendEntry( new ListGumpEntry( "Hide", b => { Selected.Hidden = true; Refresh(true); }, HighlightHue)); } } else { list.AppendEntry( new ListGumpEntry( "Unhide", b => { Selected.Hidden = false; Refresh(true); }, HighlightHue)); } } list.AppendEntry( new ListGumpEntry( "Delete", b => { if (UseConfirmDialog) { Send( new ConfirmDialogGump( User, this, title: "Delete Battle?", html: "All data associated with this battle will be deleted.\nThis action can not be reversed!\nDo you want to continue?", onAccept: OnConfirmDeleteBattle)); } else { OnConfirmDeleteBattle(b); } }, HighlightHue)); } list.AppendEntry( new ListGumpEntry( "Command List", b => { StringBuilder html = new StringBuilder(); Selected.GetHtmlCommandList(User, html); new HtmlPanelGump <PvPBattle>(User, this, title: "Command List", html: html.ToString(), selected: Selected).Send(); })); PvPProfile profile = AutoPvP.EnsureProfile(User); if (profile != null && !profile.Deleted) { if (profile.IsSubscribed(Selected)) { list.AppendEntry( new ListGumpEntry( "Unsubscribe", b => { profile.Unsubscribe(Selected); User.SendMessage("You have unsubscribed from {0} notifications.", Selected.Name); Refresh(true); })); } else { list.AppendEntry( new ListGumpEntry( "Subscribe", b => { if (UseConfirmDialog) { Send( new ConfirmDialogGump( User, this, title: "Subscriptions", html: "Subscribing to a battle allows you to see its world broadcast notifications.\n\nDo you want to subscribe to " + Selected.Name + "?", onAccept: OnConfirmSubscribe)); } else { OnConfirmSubscribe(b); } })); } } if (Selected.IsParticipant(User)) { list.AppendEntry(new ListGumpEntry("Quit & Leave", b => Selected.Eject(User, true))); } else { if (Selected.IsQueued(User)) { list.AppendEntry(new ListGumpEntry("Leave Queue", b => Selected.Dequeue(User))); } else if (Selected.CanQueue(User)) { list.AppendEntry(new ListGumpEntry("Join Queue", b => Selected.Enqueue(User))); } if (Selected.IsSpectator(User)) { list.AppendEntry(new ListGumpEntry("Leave Spectators", b => Selected.RemoveSpectator(User, true))); } else if (Selected.CanSpectate(User)) { list.AppendEntry(new ListGumpEntry("Join Spectators", b => Selected.AddSpectator(User, true))); } } } base.CompileMenuOptions(list); }
protected override void CompileMenuOptions(MenuGumpOptions list) { list.Clear(); if (Selected != null && !Selected.Deleted) { if (User.AccessLevel >= AutoPvP.Access) { list.AppendEntry( "Edit Options", b => { Minimize(); var pg = new PropertiesGump(User, Selected) { X = b.X, Y = b.Y }; User.SendGump(pg); }, HighlightHue); list.AppendEntry( "Edit Advanced Options", b => { Minimize(); var pg = new PropertiesGump(User, Selected.Options) { X = b.X, Y = b.Y }; User.SendGump(pg); }, HighlightHue); if (Selected.State == PvPBattleState.Internal) { list.AppendEntry( "Edit Spectate Region", b => { if (Selected.SpectateRegion == null) { Selected.SpectateRegion = RegionExtUtility.Create <PvPSpectateRegion>(Selected); } new PvPSpectateBoundsGump(User, Selected, Hide(true)).Send(); }, HighlightHue); list.AppendEntry( "Edit Battle Region", b => { if (Selected.BattleRegion == null) { Selected.BattleRegion = RegionExtUtility.Create <PvPBattleRegion>(Selected); } new PvPBattleBoundsGump(User, Selected, Hide(true)).Send(); }, HighlightHue); } list.AppendEntry( "Edit Doors", b => new PvPDoorsUI(User, Selected, Hide(true), UseConfirmDialog).Send(), HighlightHue); list.AppendEntry( "Edit Description", b => new TextInputPanelGump <PvPBattle>(User, Hide(true)) { Title = "Battle Description (HTML/BBC Supported)", Input = Selected.Description, Limit = 1000, Callback = s => { s = s.ParseBBCode(); if (!String.IsNullOrWhiteSpace(s)) { Selected.Description = s; } Refresh(true); } }.Send(), HighlightHue); } list.AppendEntry( "View Schedule", b => new ScheduleOverviewGump(User, Selected.Schedule, Hide(true)).Send(), User.AccessLevel >= AutoPvP.Access ? HighlightHue : TextHue); if (User.AccessLevel >= AutoPvP.Access) { list.AppendEntry( "View Rules/Restrictions", b => { var opts = new MenuGumpOptions(); opts.AppendEntry( "Inherit Rules/Restrictions", b2 => { var opts2 = new MenuGumpOptions(); foreach (var ba in AutoPvP.Battles.Values.Where(ba => ba != Selected)) { opts2.AppendEntry( ba.Name, () => { Selected.Options.Rules.CopyFrom(ba.Options.Rules); Selected.Options.Restrictions.Items.List = // new Dictionary <Type, bool>(ba.Options.Restrictions.Items.List); Selected.Options.Restrictions.Pets.List = // new Dictionary <Type, bool>(ba.Options.Restrictions.Pets.List); Selected.Options.Restrictions.Spells.List = // new Dictionary <Type, bool>(ba.Options.Restrictions.Spells.List); Selected.Options.Restrictions.Skills.List = // new Dictionary <int, bool>(ba.Options.Restrictions.Skills.List); Refresh(true); }); } new MenuGump(User, this, opts2, b).Send(); }); opts.AppendEntry( new ListGumpEntry( "Rules", mb => { Refresh(); var g = new PropertiesGump(User, Selected.Options.Rules) { X = mb.X, Y = mb.Y }; User.SendGump(g); })); opts.AppendEntry( "Items", mb => new PvPRestrictItemsListGump(User, Selected.Options.Restrictions.Items, Hide(true)).Send()); opts.AppendEntry( "Pets", mb => new PvPRestrictPetsListGump(User, Selected.Options.Restrictions.Pets, Hide(true)).Send()); opts.AppendEntry( "Skills", mb => new PvPRestrictSkillsListGump(User, Selected.Options.Restrictions.Skills, Hide(true)).Send()); opts.AppendEntry( "Spells", mb => new PvPRestrictSpellsListGump(User, Selected.Options.Restrictions.Spells, Hide(true)).Send()); new MenuGump(User, this, opts, b).Send(); }, User.AccessLevel >= AutoPvP.Access ? HighlightHue : TextHue); list.AppendEntry( "Reset Statistics", b => { if (UseConfirmDialog) { new ConfirmDialogGump(User, this) { Title = "Reset Battle Statistics?", Html = "All data associated with the battle statistics will " + "be transferred to player profiles then cleared.\nThis action can not be reversed!\n" + "Do you want to continue?", AcceptHandler = OnConfirmResetStatistics, CancelHandler = Refresh }.Send(); } else { OnConfirmResetStatistics(b); } }, HighlightHue); if (Selected.State == PvPBattleState.Internal) { if (Selected.Validate(User)) { list.AppendEntry( "Publish", b => { Selected.State = PvPBattleState.Queueing; Refresh(true); }, HighlightHue); } } else { list.AppendEntry( "Internalize", b => { Selected.State = PvPBattleState.Internal; Refresh(true); }, HighlightHue); if (!Selected.Hidden) { if (Selected.Validate(User)) { list.AppendEntry( "Hide", b => { Selected.Hidden = true; Refresh(true); }, HighlightHue); } } else { list.AppendEntry( "Unhide", b => { Selected.Hidden = false; Refresh(true); }, HighlightHue); } } list.AppendEntry( "Delete", b => { if (UseConfirmDialog) { new ConfirmDialogGump(User, this) { Title = "Delete Battle?", Html = "All data associated with this battle will be deleted.\n" + "This action can not be reversed!\nDo you want to continue?", AcceptHandler = OnConfirmDeleteBattle, CancelHandler = Refresh }.Send(); } else { OnConfirmDeleteBattle(b); } }, HighlightHue); } list.AppendEntry( "Command List", b => { var html = new StringBuilder(); Selected.GetHtmlCommandList(User, html); new HtmlPanelGump <PvPBattle>(User, this) { Title = "Command List", Html = html.ToString(), Selected = Selected }.Send(); }); var profile = AutoPvP.EnsureProfile(User as PlayerMobile); if (profile != null && !profile.Deleted) { if (profile.IsSubscribed(Selected)) { list.AppendEntry( "Unsubscribe", b => { profile.Unsubscribe(Selected); User.SendMessage("You have unsubscribed from {0} notifications.", Selected.Name); Refresh(true); }); } else { list.AppendEntry( "Subscribe", b => { if (UseConfirmDialog) { new ConfirmDialogGump(User, this) { Title = "Subscriptions", Html = "Subscribing to a battle allows you to see its world broadcast notifications.\n\n" + "Do you want to subscribe to " + Selected.Name + "?", AcceptHandler = OnConfirmSubscribe, CancelHandler = Refresh }.Send(); } else { OnConfirmSubscribe(b); } }); } } if (User is PlayerMobile) { var user = (PlayerMobile)User; if (Selected.IsParticipant(user)) { list.AppendEntry("Quit & Leave", b => Selected.Quit(user, true)); } else { if (Selected.IsQueued(user)) { list.AppendEntry("Leave Queue", b => Selected.Dequeue(user)); } else if (Selected.CanQueue(user)) { list.AppendEntry("Join Queue", b => Selected.Enqueue(user)); } if (Selected.IsSpectator(user)) { list.AppendEntry("Leave Spectators", b => Selected.RemoveSpectator(user, true)); } else if (Selected.CanSpectate(user)) { list.AppendEntry("Join Spectators", b => Selected.AddSpectator(user, true)); } } } } base.CompileMenuOptions(list); }
public void Render() { AddNewPage(); if (m_Page > 0) { AddEntryButton(20, ArrowLeftID1, ArrowLeftID2, 1, ArrowLeftWidth, ArrowLeftHeight); } else { AddEntryHeader(20); } AddEntryHtml( 40 + m_Columns.Length * 130 - 20 + (m_Columns.Length - 2) * OffsetSize, Center( $"Page {m_Page + 1} of {(m_List.Count + EntriesPerPage - 1) / EntriesPerPage}" ) ); if ((m_Page + 1) * EntriesPerPage < m_List.Count) { AddEntryButton(20, ArrowRightID1, ArrowRightID2, 2, ArrowRightWidth, ArrowRightHeight); } else { AddEntryHeader(20); } if (m_Columns.Length > 1) { AddNewLine(); for (var i = 0; i < m_Columns.Length; ++i) { if (i > 0 && m_List.Count > 0) { var obj = m_List[0]; if (obj != null) { string failReason = null; var chain = Properties.GetPropertyInfoChain( m_From, obj.GetType(), m_Columns[i], PropertyAccess.Read, ref failReason ); if (chain?.Length > 0) { m_Columns[i] = ""; for (var j = 0; j < chain.Length; ++j) { if (j > 0) { m_Columns[i] += '.'; } m_Columns[i] += chain[j].Name; } } } } AddEntryHtml(130 + (i == 0 ? 40 : 0), m_Columns[i]); } AddEntryHeader(20); } for (int i = m_Page * EntriesPerPage, line = 0; line < EntriesPerPage && i < m_List.Count; ++i, ++line) { AddNewLine(); var obj = m_List[i]; var isDeleted = false; if (obj is Item item) { if (!(isDeleted = item.Deleted)) { AddEntryHtml(40 + 130, item.GetType().Name); } } else if (obj is Mobile mob) { if (!(isDeleted = mob.Deleted)) { AddEntryHtml(40 + 130, mob.Name); } } if (isDeleted) { AddEntryHtml(40 + 130, "(deleted)"); for (var j = 1; j < m_Columns.Length; ++j) { AddEntryHtml(130, "---"); } AddEntryHeader(20); } else { for (var j = 1; j < m_Columns.Length; ++j) { var src = obj; string value; var failReason = ""; var chain = Properties.GetPropertyInfoChain( m_From, src.GetType(), m_Columns[j], PropertyAccess.Read, ref failReason ); if (chain == null || chain.Length == 0) { value = "---"; } else { var p = Properties.GetPropertyInfo(ref src, chain, ref failReason); if (p == null) { value = "---"; } else { value = PropertiesGump.ValueToString(src, p); } } AddEntryHtml(130, value); } var isSelected = m_Select != null && obj == m_Select; AddEntryButton( 20, isSelected ? 9762 : ArrowRightID1, isSelected ? 9763 : ArrowRightID2, 3 + i, ArrowRightWidth, ArrowRightHeight ); } } FinishPage(); }
protected virtual void CompileOptions(ToolbarGump toolbar, GumpButton clicked, Point loc, MenuGumpOptions opts) { if (toolbar == null) { return; } PlayerMobile user = toolbar.User; if (CanEdit || user.AccessLevel >= Toolbars.Access) { if (!toolbar.GlobalEdit) { opts.AppendEntry( new ListGumpEntry( "Load Default", b => SuperGump.Send( new ConfirmDialogGump(user, toolbar) { Title = "Load Default", Html = "Loading the default entry will overwrite your custom entry.\n\nDo you want to continue?", AcceptHandler = db => { ToolbarEntry def = Toolbars.DefaultEntries.GetContent(loc.X, loc.Y); toolbar.State.SetContent(loc.X, loc.Y, def != null ? def.Clone() : null); toolbar.Refresh(true); } }), toolbar.HighlightHue)); } opts.AppendEntry( new ListGumpEntry( "Reset", b => { Reset(toolbar); toolbar.Refresh(true); }, toolbar.HighlightHue)); } if (CanDelete || user.AccessLevel >= Toolbars.Access) { opts.AppendEntry( new ListGumpEntry( "Delete", b => { toolbar.State.SetContent(loc.X, loc.Y, null); toolbar.Refresh(true); }, toolbar.HighlightHue)); } if (CanEdit || user.AccessLevel >= Toolbars.Access) { opts.AppendEntry( new ListGumpEntry( "Set Value", b => SuperGump.Send( new InputDialogGump(user, toolbar) { Title = "Set Value", Html = "Set the value of this entry.", InputText = Value, Callback = (cb, text) => { Value = text; toolbar.Refresh(true); } }), toolbar.HighlightHue)); opts.AppendEntry( new ListGumpEntry( "Set Label", b => SuperGump.Send( new InputDialogGump(user, toolbar) { Title = "Set Label", Html = "Set the label of this entry.", InputText = Label, Callback = (cb, text) => { Label = text; toolbar.Refresh(true); } }), toolbar.HighlightHue)); opts.AppendEntry( new ListGumpEntry( "Set Label Color", b => { int rrr = 255, ggg = 255, bbb = 255; if (LabelColor != null) { rrr = LabelColor.Value.R; ggg = LabelColor.Value.G; bbb = LabelColor.Value.B; } SuperGump.Send( new InputDialogGump(user, toolbar) { Title = "Set Label Color", Html = "Set the label color for this entry.\nFormat 1: NamedColor (EG; Red)\nFormat 2: RRR,GGG,BBB", InputText = String.Format("{0:D3},{1:D3},{2:D3}", rrr, ggg, bbb), Callback = (cb, text) => { if (!String.IsNullOrWhiteSpace(text)) { if (text.IndexOf(',') != -1) { var args = text.Split(','); if (args.Length >= 3) { Int32.TryParse(args[0], out rrr); Int32.TryParse(args[1], out ggg); Int32.TryParse(args[2], out bbb); rrr = Math.Min(255, Math.Max(0, rrr)); ggg = Math.Min(255, Math.Max(0, ggg)); bbb = Math.Min(255, Math.Max(0, bbb)); LabelColor = Color.FromArgb(rrr, ggg, bbb); } } else { try { LabelColor = Color.FromName(text); } catch { } } } toolbar.Refresh(true); } }); }, toolbar.HighlightHue)); if (Highlight) { opts.Replace( "Highlight", new ListGumpEntry( "Unhighlight", b => { Highlight = false; toolbar.Refresh(true); }, toolbar.ErrorHue)); } else { opts.Replace( "Unhighlight", new ListGumpEntry( "Highlight", b => { Highlight = true; toolbar.Refresh(true); }, toolbar.HighlightHue)); } } if (user.AccessLevel < Toolbars.Access) { return; } opts.AppendEntry( new ListGumpEntry( "Open Props", b => SuperGump.Send( new NoticeDialogGump(user, toolbar) { Title = "Props Note", Html = "Editing the properties of an entry this way requires a hard refresh.\nExit and re-open the Toolbar when you make any changes.", AcceptHandler = cb => { toolbar.Refresh(true); PropertiesGump pg = new PropertiesGump(user, this) { X = b.X, Y = b.Y }; user.SendGump(pg); } }), toolbar.HighlightHue)); if (toolbar.GlobalEdit && toolbar.CanGlobalEdit()) { opts.AppendEntry( new ListGumpEntry( "Global Apply", b => SuperGump.Send( new ConfirmDialogGump(user, toolbar) { Title = "Global Apply", Html = "Applying this entry globally will overwrite any custom entries at the entry location on all existing toolbars.\n\nDo you want to continue?", AcceptHandler = db => { ToolbarEntry def = Toolbars.DefaultEntries.GetContent(loc.X, loc.Y); foreach (ToolbarState tbs in Toolbars.Profiles.Values) { try { tbs.SetContent(loc.X, loc.Y, def != null ? def.Clone() : null); SuperGump tb = tbs.GetToolbarGump(); if (tb != null && tb.IsOpen) { tb.Refresh(true); } } catch { } } } }), toolbar.HighlightHue)); } }
protected override void SelectEntry(GumpButton button, IVoteSite entry) { base.SelectEntry(button, entry); var opts = new MenuGumpOptions(); if (User.AccessLevel >= Voting.Access) { opts.AppendEntry( new ListGumpEntry( "Options", b => { Refresh(); var pg = new PropertiesGump(User, Selected) { X = b.X, Y = b.Y }; User.SendGump(pg); }, HighlightHue)); opts.AppendEntry( new ListGumpEntry( entry.Enabled ? "Disable" : "Enable", b1 => { entry.Enabled = !entry.Enabled; Refresh(true); }, entry.Enabled ? ErrorHue : HighlightHue)); opts.AppendEntry(new ListGumpEntry("Delete", DeleteSite, ErrorHue)); opts.AppendEntry( new ListGumpEntry( "Add To Stone", b => { Minimize(b); User.SendMessage(0x55, "Select a compatible Voting Stone..."); ItemSelectTarget <VotingStone> .Begin( User, (u, s) => { if (s != null && !s.Deleted) { s.SiteUID = entry.UID; User.SendMessage(0x55, "The Voting Stone site was changed to {0}.", entry.Name); } else { User.SendMessage(0x22, "That is not a compatible Voting Stone."); } Maximize(); }, u => Maximize()); })); opts.AppendEntry( new ListGumpEntry( "Create Stone", b => Send( new ConfirmDialogGump(User, this) { Title = "Create Voting Stone?", Html = "You didn't select a compatible Voting Stone.\nDo you want to create one in your pack?\n" + "Click OK to create a new Voting Stone for this site.", AcceptHandler = ab => { var stone = new VotingStone(entry.UID); if (User.AddToBackpack(stone)) { User.SendMessage(0x22, "The new Voting Stone was placed in your pack."); } else { stone.MoveToWorld(User.Location, User.Map); User.SendMessage(0x22, "The new Voting Stone was placed at your feet."); } } }))); opts.AppendEntry(new ListGumpEntry("Cancel", b => { })); } Send(new MenuGump(User, Refresh(), opts, button)); }
public void Render() { this.AddNewPage(); if (this.m_Page > 0) { this.AddEntryButton(20, ArrowLeftID1, ArrowLeftID2, 1, ArrowLeftWidth, ArrowLeftHeight); } else { this.AddEntryHeader(20); } this.AddEntryHtml(40 + (this.m_Columns.Length * 130) - 20 + ((this.m_Columns.Length - 2) * this.OffsetSize), this.Center(String.Format("Page {0} of {1}", this.m_Page + 1, (this.m_List.Count + EntriesPerPage - 1) / EntriesPerPage))); if ((this.m_Page + 1) * EntriesPerPage < this.m_List.Count) { this.AddEntryButton(20, ArrowRightID1, ArrowRightID2, 2, ArrowRightWidth, ArrowRightHeight); } else { this.AddEntryHeader(20); } if (this.m_Columns.Length > 1) { this.AddNewLine(); for (int i = 0; i < this.m_Columns.Length; ++i) { if (i > 0 && this.m_List.Count > 0) { object obj = this.m_List[0]; if (obj != null) { string failReason = null; PropertyInfo[] chain = Properties.GetPropertyInfoChain(this.m_From, obj.GetType(), this.m_Columns[i], PropertyAccess.Read, ref failReason); if (chain != null && chain.Length > 0) { this.m_Columns[i] = ""; for (int j = 0; j < chain.Length; ++j) { if (j > 0) { this.m_Columns[i] += '.'; } this.m_Columns[i] += chain[j].Name; } } } } this.AddEntryHtml(130 + (i == 0 ? 40 : 0), this.m_Columns[i]); } this.AddEntryHeader(20); } for (int i = this.m_Page * EntriesPerPage, line = 0; line < EntriesPerPage && i < this.m_List.Count; ++i, ++line) { this.AddNewLine(); object obj = this.m_List[i]; bool isDeleted = false; if (obj is Item) { Item item = (Item)obj; if (!(isDeleted = item.Deleted)) { this.AddEntryHtml(40 + 130, item.GetType().Name); } } else if (obj is Mobile) { Mobile mob = (Mobile)obj; if (!(isDeleted = mob.Deleted)) { this.AddEntryHtml(40 + 130, mob.Name); } } if (isDeleted) { this.AddEntryHtml(40 + 130, "(deleted)"); for (int j = 1; j < this.m_Columns.Length; ++j) { this.AddEntryHtml(130, "---"); } this.AddEntryHeader(20); } else { for (int j = 1; j < this.m_Columns.Length; ++j) { object src = obj; string value; string failReason = ""; PropertyInfo[] chain = Properties.GetPropertyInfoChain(this.m_From, src.GetType(), this.m_Columns[j], PropertyAccess.Read, ref failReason); if (chain == null || chain.Length == 0) { value = "---"; } else { PropertyInfo p = Properties.GetPropertyInfo(ref src, chain, ref failReason); if (p == null) { value = "---"; } else { value = PropertiesGump.ValueToString(src, p); } } this.AddEntryHtml(130, value); } bool isSelected = (this.m_Select != null && obj == this.m_Select); this.AddEntryButton(20, (isSelected ? 9762 : ArrowRightID1), (isSelected ? 9763 : ArrowRightID2), 3 + i, ArrowRightWidth, ArrowRightHeight); } } this.FinishPage(); }
public override void OnResponse(NetState sender, RelayInfo info) { object toSet; bool shouldSet, shouldSend = true; switch (info.ButtonID) { case 1: { TextRelay text = info.GetTextEntry(0); if (text != null) { try { toSet = PropertiesGump.GetObjectFromString(m_Property.PropertyType, text.Text); shouldSet = true; } catch { toSet = null; shouldSet = false; m_From.SendMessage("Bad format"); } } else { toSet = null; shouldSet = false; } break; } case 2: // Null { toSet = null; shouldSet = true; break; } case 3: // Hue Picker { toSet = null; shouldSet = false; shouldSend = false; m_From.SendHuePicker(new InternalPicker(m_Property, m_From, m_HairStylist, m_PropertyList, m_Page)); break; } case 4: // Body Picker { toSet = null; shouldSet = false; shouldSend = false; m_From.SendGump(new SetBodyGump(m_Property, m_From, m_HairStylist, null, m_Page, new ArrayList(m_PropertyList))); break; } default: { toSet = null; shouldSet = false; break; } } if (shouldSet) { try { CommandLogging.LogChangeProperty(m_From, m_HairStylist, string.Format("INX Hair Stylist: {0}", m_Property.Name), toSet == null ? "(null)" : toSet.ToString()); m_Property.SetValue(m_HairStylist, toSet, null); } catch { m_From.SendMessage("An exception was caught. The property may not have changed."); } } if (shouldSend) { m_From.SendGump(new HairStylistConfigGump(m_From, m_HairStylist, m_PropertyList, m_Page)); } }