protected override OptionResult Run(GameHitParameters <Sim> parameters) { List <VectorBooter.Item> choices = VectorBooter.GetVectorItems(parameters.mTarget.SimDescription); CommonSelection <VectorBooter.Item> .Results items = new CommonSelection <VectorBooter.Item>(Name, choices).SelectMultiple(); if ((items == null) || (items.Count == 0)) { return(OptionResult.Failure); } string vectors = null; foreach (VectorBooter.Item item in items) { VectorControl.Inoculate(parameters.mTarget.SimDescription, item.Value, true, false); vectors += Common.NewLine + " " + item.Value.GetLocalizedName(parameters.mTarget.IsFemale); } if (!string.IsNullOrEmpty(vectors)) { Common.Notify(parameters.mTarget, Common.Localize("Inoculate:Success", parameters.mTarget.IsFemale, new object[] { parameters.mTarget }) + vectors); } return(OptionResult.SuccessClose); }
public static void OnAccept(Sim actor, Sim target, string interaction, ActiveTopic topic, InteractionInstance i) { try { VaccinationSessionSituation situation = VaccinationSessionSituation.GetVaccinationSessionSituation(actor); if (situation != null) { situation.NumVaccinations++; situation.AddToIgnoreList(target); situation.BringRandomSimsToSession(0x1); } else { FreeClinicSessionSituation freeClinicSessionSituation = FreeClinicSessionSituation.GetFreeClinicSessionSituation(actor); if (freeClinicSessionSituation != null) { freeClinicSessionSituation.NumVaccinations++; freeClinicSessionSituation.AddToIgnoreList(target); freeClinicSessionSituation.BringRandomSimsToSession(0x1); } } Medical medical = actor.Occupation as Medical; if ((medical != null) && (medical.Level >= 3)) { string vectors = null; List <VectorBooter.Item> items = new List <VectorBooter.Item>(); int cost = 0; foreach (VectorBooter.Data vector in VectorBooter.Vectors) { if (VectorControl.Inoculate(target.SimDescription, vector, true, true)) { vectors += Common.NewLine + " " + vector.GetLocalizedName(target.IsFemale); cost += (vector.InoculationCost / 25); } } if (string.IsNullOrEmpty(vectors)) { if (situation == null) { Common.Notify(target, Common.Localize("Inoculate:None", target.IsFemale, new object[] { target })); } } else { string paid = null; if (cost > target.FamilyFunds) { cost = target.FamilyFunds; } target.ModifyFunds(-cost); if (target.Household != actor.Household) { actor.ModifyFunds(cost); if (cost > 0) { paid += Common.NewLine + Common.NewLine + Common.Localize("Inoculate:Paid", target.IsFemale, new object[] { cost }); } } else { if (cost > 0) { paid += Common.NewLine + Common.NewLine + Common.Localize("Inoculate:Charged", target.IsFemale, new object[] { cost }); } } Common.Notify(target, Common.Localize("Inoculate:Success", target.IsFemale, new object[] { target }) + vectors + paid); } } } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(actor, target, e); } }