Ejemplo n.º 1
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);
            }
        }
Ejemplo n.º 2
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);
            }
        }