public static void ApplyInsuranceChanges( Mobile from, ItemInsuranceInfo[] arInfo ) { if ( !from.CheckAlive() ) return; foreach ( ItemInsuranceInfo info in arInfo ) { if ( info.Toggled ) { Item item = info.Item; if ( !item.IsChildOf( from ) ) { from.SendLocalizedMessage( 1060871, String.Empty, 0x23 ); // You can only insure items that you have equipped or that are in your backpack } else if ( item.Insured ) { item.Insured = false; from.SendLocalizedMessage( 1060874, String.Empty, 0x35 ); // You cancel the insurance on the item } else { if ( !item.PayedInsurance ) { int cost = info.GetCost(); if ( Banker.Withdraw( from, cost ) ) { from.SendLocalizedMessage( 1060398, cost.ToString() ); // ~1_AMOUNT~ gold has been withdrawn from your bank box. item.PayedInsurance = true; } else { from.SendLocalizedMessage( 1061079, String.Empty, 0x23 ); // You lack the funds to purchase the insurance continue; } } item.Insured = true; from.SendLocalizedMessage( 1060873, String.Empty, 0x23 ); // You have insured the item } } } }
public ConfirmationCancelInsuranceGump( PlayerMobile pm, ItemInsuranceInfo[] info ) : base(250, 200) { m_Owner = pm; m_InsuranceInfo = info; AddPage( 0 ); AddBackground( 0, 0, 240, 142, 5054 ); AddImageTiled( 6, 6, 228, 100, 2624 ); AddImageTiled( 6, 116, 228, 20, 2624 ); AddAlphaRegion( 6, 6, 228, 142 ); AddHtmlLocalized( 8, 8, 228, 100, 1071021, 0x7FFF, false, false ); // You are about to disable inventory insurance auto-renewal. AddButton( 114, 116, 4005, 4007, 100, GumpButtonType.Reply, 0 ); AddHtmlLocalized( 148, 118, 450, 20, 1071022, 0x7FFF, false, false ); // DISABLE IT! AddButton( 6, 116, 4017, 4018, 0, GumpButtonType.Reply, 0 ); AddHtmlLocalized( 40, 118, 450, 20, 1060051, 0x7FFF, false, false ); // CANCEL }
public ConfirmInsureGump( PlayerMobile pm, ItemInsuranceInfo[] info ) : base(250, 200) { m_Owner = pm; m_InsuranceInfo = info; AddPage( 0 ); AddBackground( 0, 0, 240, 142, 5054 ); AddImageTiled( 6, 6, 228, 100, 2624 ); AddImageTiled( 6, 116, 228, 20, 2624 ); AddAlphaRegion( 6, 6, 228, 142 ); AddHtmlLocalized( 8, 8, 228, 100, 1114300, 0x7FFF, false, false ); // Do you wish to insure all newly selected items? AddButton( 114, 116, 4005, 4007, 100, GumpButtonType.Reply, 0 ); AddHtmlLocalized( 148, 118, 450, 20, 1073996, 0x7FFF, false, false ); // ACCEPT AddButton( 6, 116, 4017, 4018, 0, GumpButtonType.Reply, 0 ); AddHtmlLocalized( 40, 118, 450, 20, 1060051, 0x7FFF, false, false ); // CANCEL }
public ItemInsuranceMenu( PlayerMobile pm, ItemInsuranceInfo[] infoCollection, int page ) : base(25, 50) { if ( page < 0 ) page = 0; m_Owner = pm; m_ItemInsuranceInfo = infoCollection; m_Page = page; int totalGold = Banker.GetBalance( pm ); int totalCost = ComputeTotalCost(); int totalDeaths = ( totalCost == 0 ? 0 : totalGold / totalCost ); AddPage( 0 ); AddBackground( 0, 0, 520, 510, 0x13BE ); AddImageTiled( 10, 10, 500, 30, 0xA40 ); AddImageTiled( 10, 50, 500, 355, 0xA40 ); AddImageTiled( 10, 415, 500, 80, 0xA40 ); AddAlphaRegion( 10, 10, 500, 485 ); AddHtmlLocalized( 10, 14, 150, 20, 1114121, 0x7FFF, false, false ); // <CENTER>ITEM INSURANCE MENU</CENTER> AddHtmlLocalized( 15, 420, 300, 20, 1114310, 0x7FFF, false, false ); // GOLD AVAILABLE: AddLabel( 215, 420, 0x481, totalGold.ToString() ); AddHtmlLocalized( 15, 435, 300, 20, 1114123, 0x7FFF, false, false ); // TOTAL COST OF INSURANCE: AddLabel( 215, 435, 0x481, totalCost.ToString() ); AddHtmlLocalized( 15, 450, 300, 20, 1114125, 0x7FFF, false, false ); // NUMBER OF DEATHS PAYABLE: AddLabel( 215, 450, 0x481, totalDeaths.ToString() ); AddHtmlLocalized( 395, 14, 105, 20, 1114122, 0x7FFF, false, false ); // AUTO REINSURE AddCheckButton( 360, 10, 1, pm.AutoRenewInsurance ); AddHtmlLocalized( 45, 54, 70, 20, 1062214, 0x7FFF, false, false ); // Item AddHtmlLocalized( 250, 54, 70, 20, 1061038, 0x7FFF, false, false ); // Cost AddHtmlLocalized( 400, 54, 70, 20, 1114311, 0x7FFF, false, false ); // Insured int idx = page * ItemsPerPage; for ( int i = 0; i < ItemsPerPage && idx < m_ItemInsuranceInfo.Length; i++, idx++ ) { ItemInsuranceInfo info = m_ItemInsuranceInfo[idx]; AddButtonTileArt( 40, 72 + ( i * 75 ), 0x918, 0x918, GumpButtonType.Page, 0, 0, info.Item.ItemID, info.Item.Hue, 23, 5 ); AddItemProperty( info.Item ); AddCheckButton( 400, 72 + ( i * 75 ), 100 + idx, info.NowInsured() ); AddLabel( 250, 72 + ( i * 75 ), info.NowInsured() ? 0x481 : 0x66C, info.GetCost().ToString() ); } if ( page > 0 ) { AddHtmlLocalized( 50, 380, 450, 20, 1044044, 0x7FFF, false, false ); // PREV PAGE AddButton( 15, 380, 0xFAE, 0xFAF, 503, GumpButtonType.Reply, 0 ); } if ( idx < m_ItemInsuranceInfo.Length ) { AddHtmlLocalized( 435, 380, 70, 20, 1044045, 0x7FFF, false, false ); // NEXT PAGE AddButton( 400, 380, 0xFA5, 0xFA7, 505, GumpButtonType.Reply, 0 ); } AddHtmlLocalized( 430, 472, 50, 20, 1006044, 0x7FFF, false, false ); // OK AddButton( 395, 470, 0xFA5, 0xFA6, 2, GumpButtonType.Reply, 0 ); AddHtmlLocalized( 50, 472, 80, 20, 1011012, 0x7FFF, false, false ); // CANCEL AddButton( 15, 470, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0 ); }
public ItemInsuranceMenu( PlayerMobile pm, ItemInsuranceInfo[] infoCollection ) : this(pm, infoCollection, 0) { }
public ItemInsuranceMenu(PlayerMobile pm, ItemInsuranceInfo[] infoCollection, int page) : base(25, 50) { if (page < 0) { page = 0; } m_Owner = pm; m_ItemInsuranceInfo = infoCollection; m_Page = page; int totalGold = Banker.GetBalance(pm); int totalCost = ComputeTotalCost(); int totalDeaths = (totalCost == 0 ? 0 : totalGold / totalCost); AddPage(0); AddBackground(0, 0, 520, 510, 0x13BE); AddImageTiled(10, 10, 500, 30, 0xA40); AddImageTiled(10, 50, 500, 355, 0xA40); AddImageTiled(10, 415, 500, 80, 0xA40); AddAlphaRegion(10, 10, 500, 485); AddHtmlLocalized(10, 14, 150, 20, 1114121, 0x7FFF, false, false); // <CENTER>ITEM INSURANCE MENU</CENTER> AddHtmlLocalized(15, 420, 300, 20, 1114310, 0x7FFF, false, false); // GOLD AVAILABLE: AddLabel(215, 420, 0x481, totalGold.ToString()); AddHtmlLocalized(15, 435, 300, 20, 1114123, 0x7FFF, false, false); // TOTAL COST OF INSURANCE: AddLabel(215, 435, 0x481, totalCost.ToString()); AddHtmlLocalized(15, 450, 300, 20, 1114125, 0x7FFF, false, false); // NUMBER OF DEATHS PAYABLE: AddLabel(215, 450, 0x481, totalDeaths.ToString()); AddHtmlLocalized(395, 14, 105, 20, 1114122, 0x7FFF, false, false); // AUTO REINSURE AddCheckButton(360, 10, 1, pm.AutoRenewInsurance); AddHtmlLocalized(45, 54, 70, 20, 1062214, 0x7FFF, false, false); // Item AddHtmlLocalized(250, 54, 70, 20, 1061038, 0x7FFF, false, false); // Cost AddHtmlLocalized(400, 54, 70, 20, 1114311, 0x7FFF, false, false); // Insured int idx = page * ItemsPerPage; for (int i = 0; i < ItemsPerPage && idx < m_ItemInsuranceInfo.Length; i++, idx++) { ItemInsuranceInfo info = m_ItemInsuranceInfo[idx]; AddButtonTileArt(40, 72 + (i * 75), 0x918, 0x918, GumpButtonType.Page, 0, 0, info.Item.ItemID, info.Item.Hue, 23, 5); AddItemProperty(info.Item); AddCheckButton(400, 72 + (i * 75), 100 + idx, info.NowInsured()); AddLabel(250, 72 + (i * 75), info.NowInsured() ? 0x481 : 0x66C, info.GetCost().ToString()); } if (page > 0) { AddHtmlLocalized(50, 380, 450, 20, 1044044, 0x7FFF, false, false); // PREV PAGE AddButton(15, 380, 0xFAE, 0xFAF, 503, GumpButtonType.Reply, 0); } if (idx < m_ItemInsuranceInfo.Length) { AddHtmlLocalized(435, 380, 70, 20, 1044045, 0x7FFF, false, false); // NEXT PAGE AddButton(400, 380, 0xFA5, 0xFA7, 505, GumpButtonType.Reply, 0); } AddHtmlLocalized(430, 472, 50, 20, 1006044, 0x7FFF, false, false); // OK AddButton(395, 470, 0xFA5, 0xFA6, 2, GumpButtonType.Reply, 0); AddHtmlLocalized(50, 472, 80, 20, 1011012, 0x7FFF, false, false); // CANCEL AddButton(15, 470, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0); }