示例#1
0
        public static bool OnCallbackTest(Sim actor, Sim target, ActiveTopic topic, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
        {
            try
            {
                if (actor.Household == target.Household)
                {
                    return(false);
                }

                if (actor.SkillManager == null)
                {
                    return(false);
                }

                Assassination skill = actor.SkillManager.GetSkill <Assassination>(Assassination.StaticGuid);
                if (skill == null)
                {
                    return(false);
                }

                if (skill.GetNetAggression() == 0)
                {
                    return(false);
                }

                Occupation career = target.Occupation;
                if (career == null)
                {
                    return(false);
                }

                if (career is LawEnforcement)
                {
                    return(true);
                }

                if (career is Political)
                {
                    return(true);
                }

                return(false);
            }
            catch (Exception e)
            {
                Common.Exception(actor, target, e);
                return(false);
            }
        }
示例#2
0
            public override bool Test(Sim a, RabbitHole target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
            {
                if (a.SkillManager == null)
                {
                    return(false);
                }

                Assassination skill = a.SkillManager.GetSkill <Assassination>(Assassination.StaticGuid);

                if (skill == null)
                {
                    return(false);
                }

                if (skill.GetNetAggression() == 0)
                {
                    return(false);
                }

                return(true);
            }
示例#3
0
        public override bool InRabbitHole()
        {
            try
            {
                Assassination skill = Actor.SkillManager.GetSkill <Assassination>(Assassination.StaticGuid);
                if (skill == null)
                {
                    return(false);
                }

                if (skill.GetNetAggression() == 0)
                {
                    return(false);
                }

                StartStages();
                BeginCommodityUpdates();
                bool succeeded = false;

                try
                {
                    succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached));
                }
                finally
                {
                    EndCommodityUpdates(succeeded);
                }

                if (!succeeded)
                {
                    return(succeeded);
                }

                int owed = (int)(skill.GetNetAggression() * (1 + Assassination.Settings.mRabbitHoleCorruption));

                int funds = Actor.FamilyFunds;
                if (funds > owed)
                {
                    funds = owed;
                }

                string text = StringInputDialog.Show(Common.Localize("Bribe:MenuName", Actor.IsFemale), Common.Localize("Bribe:Prompt", Actor.IsFemale, new object[] { Actor, Assassination.Settings.mRabbitHoleCorruption * 100, owed }), funds.ToString());
                if ((text == null) || (text == ""))
                {
                    return(false);
                }

                if (!int.TryParse(text, out funds))
                {
                    return(false);
                }

                if (funds < 0)
                {
                    return(false);
                }

                if (funds > owed)
                {
                    funds = owed;
                }

                Actor.ModifyFunds(-funds);

                skill.Bribe((int)(funds * (1f - Assassination.Settings.mRabbitHoleCorruption)));
                return(true);
            }
            catch (ResetException)
            {
                throw;
            }
            catch (Exception e)
            {
                Common.Exception(Actor, Target, e);
                return(false);
            }
        }
示例#4
0
        public static void OnAccepted(Sim actor, Sim target, string interaction, ActiveTopic topic, InteractionInstance i)
        {
            try
            {
                Assassination skill = actor.SkillManager.GetSkill <Assassination>(Assassination.StaticGuid);
                if (skill == null)
                {
                    return;
                }

                if (skill.GetNetAggression() == 0)
                {
                    return;
                }

                int owed = skill.GetNetAggression();

                int funds = actor.FamilyFunds;
                if (funds > owed)
                {
                    funds = owed;
                }

                if (i.Autonomous)
                {
                    funds = RandomUtil.GetInt(owed);
                }
                else
                {
                    string text = StringInputDialog.Show(Common.Localize("Bribe:MenuName", actor.IsFemale), Common.Localize("Bribe:SocialPrompt", actor.IsFemale, new object[] { actor, owed }), funds.ToString());
                    if ((text == null) || (text == ""))
                    {
                        return;
                    }

                    if (!int.TryParse(text, out funds))
                    {
                        return;
                    }
                }

                if (funds < 0)
                {
                    return;
                }

                if (funds > owed)
                {
                    funds = owed;
                }

                actor.ModifyFunds(-funds);

                target.ModifyFunds(funds);

                skill.Bribe(funds);
            }
            catch (Exception e)
            {
                Common.Exception(actor, target, e);
            }
        }