Exemplo n.º 1
0
        public static void BeforeVaccinate(Sim actor, Sim target, string interaction, ActiveTopic topic, InteractionInstance i)
        {
            try
            {
                VaccinationSessionSituation vaccinationSessionSituation = VaccinationSessionSituation.GetVaccinationSessionSituation(actor);
                if (vaccinationSessionSituation != null)
                {
                    vaccinationSessionSituation.NumVaccinations++;
                    vaccinationSessionSituation.AddToIgnoreList(target);
                    vaccinationSessionSituation.BringRandomSimsToSession(0x1);

                    /*
                     * HealthManager healthManager = target.SimDescription.HealthManager;
                     * if (healthManager != null)
                     * {
                     *  healthManager.Vaccinate();
                     * }
                     */
                }
            }
            catch (Exception e)
            {
                Common.Exception(actor, target, e);
            }
        }
Exemplo n.º 2
0
        public static bool OnTest(Sim actor, Sim target, ActiveTopic topic, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
        {
            try
            {
                //bool isAutonomous = Common.IsAutonomous(actor);

                VaccinationSessionSituation situation = VaccinationSessionSituation.GetVaccinationSessionSituation(actor);
                if (situation != null)
                {
                    if (situation.IsInIgnoreList(target))
                    {
                        return(false);
                    }
                    else if (!situation.IsInSeekersList(target) && !situation.IsInInterruptedList(target))
                    {
                        return(false);
                    }
                    else if (isAutonomous && (actor.GetDistanceToObject(target) > AutographSessionSituation.MaxDistanceForAutonomousSign))
                    {
                        return(false);
                    }

                    return(true);
                }
                else
                {
                    FreeClinicSessionSituation freeClinicSessionSituation = FreeClinicSessionSituation.GetFreeClinicSessionSituation(actor);
                    if (freeClinicSessionSituation != null)
                    {
                        if (freeClinicSessionSituation.IsInIgnoreList(target))
                        {
                            return(false);
                        }
                        else if (!freeClinicSessionSituation.IsInSeekersList(target) && !freeClinicSessionSituation.IsInInterruptedList(target))
                        {
                            return(false);
                        }
                        else if (isAutonomous && (actor.GetDistanceToObject(target) > AutographSessionSituation.MaxDistanceForAutonomousSign))
                        {
                            return(false);
                        }
                    }
                    else if (isAutonomous)
                    {
                        return(false);
                    }
                }

                Medical medical = actor.Occupation as Medical;
                return((medical != null) && (medical.Level >= 3));
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(actor, target, e);
                return(false);
            }
        }
Exemplo n.º 3
0
        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);
            }
        }