private bool CheckInsuranceOnDeath(Item item) { if (Young) { return false; } if (InsuranceEnabled && item.Insured) { if (XmlPoints.InsuranceIsFree(this, m_InsuranceAward)) { item.PayedInsurance = true; return true; } #region Dueling if (m_DuelPlayer != null && m_DuelContext != null && m_DuelContext.Registered && m_DuelContext.Started && !m_DuelPlayer.Eliminated) { return true; } #endregion int insuredAmount = item.GetInsuranceCost(); if (AutoRenewInsurance) { int cost = (m_InsuranceAward == null ? insuredAmount : insuredAmount / 2); if (Banker.Withdraw(this, cost)) { m_InsuranceCost += cost; item.PayedInsurance = true; SendLocalizedMessage(1060398, cost.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box. } else { SendLocalizedMessage(1061079, "", 0x23); // You lack the funds to purchase the insurance item.PayedInsurance = false; item.Insured = false; m_NonAutoreinsuredItems++; } } else { item.PayedInsurance = false; item.Insured = false; } if (m_InsuranceAward != null) { if (Banker.Deposit(m_InsuranceAward, insuredAmount / 2)) { if (m_InsuranceAward is PlayerMobile) { ((PlayerMobile)m_InsuranceAward).m_InsuranceBonus += insuredAmount / 2; } } } return true; } return false; }
private void ToggleItemInsurance_Callback(Mobile from, Item item, bool target) { if (item == null || !item.IsChildOf(this)) { if (target) BeginTarget(-1, false, TargetFlags.None, new TargetCallback(ToggleItemInsurance_Callback)); SendLocalizedMessage(1060871, "", 0x23); // You can only insure items that you have equipped or that are in your backpack } else if (item.Insured) { item.Insured = false; SendLocalizedMessage(1060874, "", 0x35); // You cancel the insurance on the item if (target) { BeginTarget(-1, false, TargetFlags.None, new TargetCallback(ToggleItemInsurance_Callback)); SendLocalizedMessage(1060868, "", 0x23); // Target the item you wish to toggle insurance status on <ESC> to cancel } } else if (!CanInsure(item)) { if (target) BeginTarget(-1, false, TargetFlags.None, new TargetCallback(ToggleItemInsurance_Callback)); SendLocalizedMessage(1060869, "", 0x23); // You cannot insure that } else { if (!item.PayedInsurance) { int cost = item.GetInsuranceCost(); if (Banker.Withdraw(from, cost)) { SendLocalizedMessage(1060398, cost.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box. item.PayedInsurance = true; } else { SendLocalizedMessage(1061079, "", 0x23); // You lack the funds to purchase the insurance return; } } item.Insured = true; SendLocalizedMessage(1060873, "", 0x23); // You have insured the item if (target) { BeginTarget(-1, false, TargetFlags.None, new TargetCallback(ToggleItemInsurance_Callback)); SendLocalizedMessage(1060868, "", 0x23); // Target the item you wish to toggle insurance status on <ESC> to cancel } } }