コード例 #1
0
ファイル: Remove.cs プロジェクト: yakoder/NRaas
        protected override bool Allow(GameHitParameters <IGameObject> parameters)
        {
            mTarget = Select.GetGiver(parameters.mTarget);
            if (mTarget == null)
            {
                return(false);
            }

            if (RoleManagerTaskEx.IsLoading)
            {
                return(false);
            }

            if (mTarget.CurrentRole == null)
            {
                return(false);
            }

            if (!Common.kDebugging)
            {
                SimDescription sim = mTarget.CurrentRole.mSim;
                if (sim == null)
                {
                    return(false);
                }
            }

            return(base.Allow(parameters));
        }
コード例 #2
0
ファイル: Select.cs プロジェクト: yakoder/NRaas
        protected override OptionResult Run(GameHitParameters <IGameObject> parameters)
        {
            IRoleGiver giver = GetGiver(parameters.mTarget);

            if (giver == null)
            {
                return(OptionResult.Failure);
            }

            SimDescription sim = PrivateRun(parameters.mActor, giver.RoleType, parameters.mHit);

            if (sim == null)
            {
                return(OptionResult.Failure);
            }

            if (GameUtils.IsFutureWorld() && (giver.RoleType == Role.RoleType.BotShopMerchant || giver.RoleType == Role.RoleType.CafeteriaWaiter) && !sim.IsEP11Bot)
            {
                return(OptionResult.Failure);
            }

            if (!Register.DropRole(sim, giver))
            {
                return(OptionResult.Failure);
            }

            if (Register.AssignRole(sim, giver.RoleType, giver))
            {
                return(OptionResult.SuccessClose);
            }
            else
            {
                return(OptionResult.Failure);
            }
        }
コード例 #3
0
        public static bool DropRole(SimDescription sim, IRoleGiver target)
        {
            if (RoleManager.sRoleManager == null)
            {
                return(false);
            }

            if (target != null)
            {
                switch (target.RoleType)
                {
                case Role.RoleType.SpecialMerchant:
                case Role.RoleType.Explorer:
                case Role.RoleType.Tourist:
                    return(false);
                }

                if (target.CurrentRole != null)
                {
                    target.CurrentRole.RemoveSimFromRole();
                }
            }

            if (sim.AssignedRole != null)
            {
                sim.AssignedRole.RemoveSimFromRole();
            }

            return(true);
        }
コード例 #4
0
        private string GetId(object item)
        {
            string id = null;

            if (item != null)
            {
                SimDescription simD = item as SimDescription;
                if (simD != null)
                {
                    id = simD.FullName;
                }

                if (id == null)
                {
                    Sim sim = item as Sim;
                    if (sim != null)
                    {
                        id = sim.FullName;
                    }
                }

                if (id == null)
                {
                    Role roleItem = item as Role;
                    if (roleItem != null)
                    {
                        id = GetId(roleItem.SimInRole);
                    }
                }

                if (id == null)
                {
                    IRoleGiver roleItem = item as IRoleGiver;
                    if (roleItem != null && roleItem.CurrentRole != null)
                    {
                        id = GetId(roleItem.CurrentRole.mSim);
                    }
                }

                if (id == null)
                {
                    IInteractionInstance roleItem = item as IInteractionInstance;
                    if (roleItem != null)
                    {
                        id = GetId(roleItem.IInstanceActor);
                    }
                }

                if (id == null)
                {
                    id = item.GetHashCode().ToString();
                }
            }
            else
            {
                id = "null";
            }

            return(id);
        }
コード例 #5
0
        protected override bool Allow(GameHitParameters <IGameObject> parameters)
        {
            mTarget = Select.GetGiver(parameters.mTarget);
            if (mTarget == null)
            {
                return(false);
            }

            if (RoleManagerTaskEx.IsLoading)
            {
                return(false);
            }

            return(base.Allow(parameters));
        }
コード例 #6
0
ファイル: RoleEx.cs プロジェクト: yakoder/NRaas
        public static bool IsSimGoodForRole(IMiniSimDescription sim, RoleData role, IRoleGiver roleGiver, out string reason)
        {
            if (role == null)
            {
                reason = "No Role";
                return(false);
            }

            if (!IsSimValidForAnyRole(sim, role.Type, out reason))
            {
                return(false);
            }

            return(IsSimGoodForRoleCommonTest(sim, role, roleGiver, out reason));
        }
コード例 #7
0
ファイル: Select.cs プロジェクト: yakoder/NRaas
        public static IRoleGiver GetGiver(IGameObject target)
        {
            IRoleGiver giver = target as IRoleGiver;

            if (giver != null)
            {
                return(giver);
            }

            ShowStage[] stages = target.LotCurrent.GetObjects <ShowStage>();

            if (stages.Length != 1)
            {
                return(null);
            }

            return(stages[0]);
        }
コード例 #8
0
        public static bool AssignRole(SimDescription sim, Role.RoleType type, IRoleGiver target)
        {
            try
            {
                RoleData data = RoleData.GetDataForCurrentWorld(type, true);
                if (data == null)
                {
                    return(false);
                }

                Role role = Role.CreateRole(data, sim, target);
                if (role == null)
                {
                    return(false);
                }

                if ((role.Data.StartTime == role.Data.EndTime) || (data.IsValidTimeForRole()))
                {
                    role.StartRoleAlarmHandler();
                }

                RoleManager.sRoleManager.AddRole(role);

                if (target != null)
                {
                    target.CurrentRole = role;
                }

                ShowNotice(role);
            }
            catch (Exception e)
            {
                Exception(sim, e);
            }

            return(true);
        }
コード例 #9
0
ファイル: Remove.cs プロジェクト: yakoder/NRaas
        protected override OptionResult Run(GameHitParameters <IGameObject> parameters)
        {
            IRoleGiver giver = Select.GetGiver(parameters.mTarget);

            if (giver == null)
            {
                return(OptionResult.Failure);
            }

            if (giver.CurrentRole == null)
            {
                return(OptionResult.Failure);
            }

            Sim sim = giver.CurrentRole.SimInRole;

            giver.CurrentRole.RemoveSimFromRole();

            if (sim != null)
            {
                SimpleMessageDialog.Show(Name, Common.Localize("Remove:Success", sim.IsFemale, new object[] { sim }));
            }
            return(OptionResult.SuccessRetain);
        }
コード例 #10
0
 public Courtesan(RoleData data, SimDescription s, IRoleGiver roleGiver)
     : base(data, s, roleGiver)
 {
 }
コード例 #11
0
ファイル: RoleEx.cs プロジェクト: yakoder/NRaas
        public static bool IsSimGoodForRole(IMiniSimDescription sim, RoleData role, IRoleGiver roleGiver)
        {
            string reason = null;

            return(IsSimGoodForRole(sim, role, roleGiver, out reason));
        }
コード例 #12
0
 public Anysim(RoleData data, SimDescription s, IRoleGiver roleGiver)
     : base(data, s, roleGiver)
 {
     base.mIsStoryProgressionProtected = false;
 }
コード例 #13
0
ファイル: Register.cs プロジェクト: Chain-Reaction/NRaas
        public static bool AssignRole(SimDescription sim, Role.RoleType type, IRoleGiver target)
        {
            try
            {
                RoleData data = RoleData.GetDataForCurrentWorld(type, true);
                if (data == null) return false;

                Role role = Role.CreateRole(data, sim, target);
                if (role == null) return false;

                if ((role.Data.StartTime == role.Data.EndTime) || (data.IsValidTimeForRole()))
                {
                    role.StartRoleAlarmHandler();
                }

                RoleManager.sRoleManager.AddRole(role);

                if (target != null)
                {
                    target.CurrentRole = role;
                }

                ShowNotice(role);
            }
            catch(Exception e)
            {
                Exception(sim, e);
            }

            return true;
        }
コード例 #14
0
ファイル: Register.cs プロジェクト: Chain-Reaction/NRaas
        public static bool DropRole(SimDescription sim, IRoleGiver target)
        {
            if (RoleManager.sRoleManager == null) return false;

            if (target != null)
            {
                switch (target.RoleType)
                {
                    case Role.RoleType.SpecialMerchant:
                    case Role.RoleType.Explorer:
                    case Role.RoleType.Tourist:
                        return false;
                }

                if (target.CurrentRole != null)
                {
                    target.CurrentRole.RemoveSimFromRole();
                }
            }

            if (sim.AssignedRole != null)
            {
                sim.AssignedRole.RemoveSimFromRole();
            }

            return true;
        }
コード例 #15
0
ファイル: RoleEx.cs プロジェクト: Robobeurre/NRaas
        public static bool IsSimGoodForRole(IMiniSimDescription sim, RoleData role, IRoleGiver roleGiver, out string reason)
        {
            if (role == null)
            {
                reason = "No Role";
                return false;
            }

            if (!IsSimValidForAnyRole(sim, role.Type, out reason)) return false;

            return IsSimGoodForRoleCommonTest(sim, role, roleGiver, out reason);
        }
コード例 #16
0
 public Drunkard(RoleData data, SimDescription s, IRoleGiver roleGiver)
     : base(data, s, roleGiver)
 {
 }
コード例 #17
0
ファイル: RoleEx.cs プロジェクト: Robobeurre/NRaas
 public static bool IsSimGoodForRole(IMiniSimDescription sim, RoleData role, IRoleGiver roleGiver)
 {
     string reason = null;
     return IsSimGoodForRole(sim, role, roleGiver, out reason);
 }
コード例 #18
0
ファイル: RoleEx.cs プロジェクト: Robobeurre/NRaas
        private static bool IsSimGoodForRoleCommonTest(IMiniSimDescription desc, RoleData data, IRoleGiver roleGiver, out string reason)
        {
            WorldName homeWorld = desc.HomeWorld;

            /*
            bool isCelebrity = desc.IsCelebrity;
            if (!data.CanBeCelebrity && isCelebrity)
            {
                reason = "Celebrity Fail";
                return false;
            }
            */
            if ((CASUtils.CASAGSAvailabilityFlagsFromCASAgeGenderFlags(desc.Age | desc.Species) & data.AvailableAgeSpecies) == CASAGSAvailabilityFlags.None)
            {
                reason = "Age/Species Fail";
                return false;
            }

            SimDescription description = desc as SimDescription;
            if (((description != null) && (description.CreatedSim == null)) && (description.WillAgeUpOnInstantiation && ((CASUtils.CASAGSAvailabilityFlagsFromCASAgeGenderFlags(AgingState.GetNextOlderAge(desc.Age, desc.Species) | desc.Species) & data.AvailableAgeSpecies) == CASAGSAvailabilityFlags.None)))
            {
                reason = "Age/Species Fail";
                return false;
            }

            if (data.FillRoleFrom == Role.RoleFillFrom.PeopleWhoDontLiveInThisWorld)
            {                
                if ((homeWorld != WorldName.TouristWorld) && (GameUtils.GetWorldType(homeWorld) != WorldType.Vacation) && (GameUtils.GetWorldType(homeWorld) != WorldType.Future))
                {
                    reason = "Vacation World Fail";
                    return false;
                }
                if (homeWorld == GameUtils.GetCurrentWorld())
                {
                    reason = "Home World Fail";
                    return false;
                }
                if (GameUtils.GetWorldType(homeWorld) == WorldType.Future)
                {
                    if (Sims3.Gameplay.Queries.CountObjects<ITimePortal>() == 0)
                    {
                        reason = "Time Portal Fail";
                        return false;
                    }                    
                }
            }
            /*
            else if (data.FillRoleFrom == RoleFillFrom.CustomCreatedSim)
            {
                return false;
            }
            */

            IRoleGiverCustomIsSimGoodTest test = roleGiver as IRoleGiverCustomIsSimGoodTest;
            if ((test != null) && (!test.IsSimGoodForRole(desc)))
            {
                reason = "Role Giver Fail";
                return false;
            }

            reason = "Success";
            return true;
        }
コード例 #19
0
ファイル: RoleEx.cs プロジェクト: yakoder/NRaas
        private static bool IsSimGoodForRoleCommonTest(IMiniSimDescription desc, RoleData data, IRoleGiver roleGiver, out string reason)
        {
            WorldName homeWorld = desc.HomeWorld;

            /*
             * bool isCelebrity = desc.IsCelebrity;
             * if (!data.CanBeCelebrity && isCelebrity)
             * {
             *  reason = "Celebrity Fail";
             *  return false;
             * }
             */
            if ((CASUtils.CASAGSAvailabilityFlagsFromCASAgeGenderFlags(desc.Age | desc.Species) & data.AvailableAgeSpecies) == CASAGSAvailabilityFlags.None)
            {
                reason = "Age/Species Fail";
                return(false);
            }

            SimDescription description = desc as SimDescription;

            if (((description != null) && (description.CreatedSim == null)) && (description.WillAgeUpOnInstantiation && ((CASUtils.CASAGSAvailabilityFlagsFromCASAgeGenderFlags(AgingState.GetNextOlderAge(desc.Age, desc.Species) | desc.Species) & data.AvailableAgeSpecies) == CASAGSAvailabilityFlags.None)))
            {
                reason = "Age/Species Fail";
                return(false);
            }

            if (data.FillRoleFrom == Role.RoleFillFrom.PeopleWhoDontLiveInThisWorld)
            {
                if ((homeWorld != WorldName.TouristWorld) && (GameUtils.GetWorldType(homeWorld) != WorldType.Vacation) && (GameUtils.GetWorldType(homeWorld) != WorldType.Future))
                {
                    reason = "Vacation World Fail";
                    return(false);
                }
                if (homeWorld == GameUtils.GetCurrentWorld())
                {
                    reason = "Home World Fail";
                    return(false);
                }
                if (GameUtils.GetWorldType(homeWorld) == WorldType.Future)
                {
                    if (Sims3.Gameplay.Queries.CountObjects <ITimePortal>() == 0)
                    {
                        reason = "Time Portal Fail";
                        return(false);
                    }
                }
            }

            /*
             * else if (data.FillRoleFrom == RoleFillFrom.CustomCreatedSim)
             * {
             *  return false;
             * }
             */

            IRoleGiverCustomIsSimGoodTest test = roleGiver as IRoleGiverCustomIsSimGoodTest;

            if ((test != null) && (!test.IsSimGoodForRole(desc)))
            {
                reason = "Role Giver Fail";
                return(false);
            }

            reason = "Success";
            return(true);
        }
コード例 #20
0
 public Anysim(RoleData data, SimDescription s, IRoleGiver roleGiver)
     : base(data, s, roleGiver)
 {
     base.mIsStoryProgressionProtected = false;
 }
コード例 #21
0
 public ExoticDancer(RoleData data, SimDescription s, IRoleGiver roleGiver)
     : base(data, s, roleGiver)
 {
 }
コード例 #22
0
 public Drunkard(RoleData data, SimDescription s, IRoleGiver roleGiver)
     : base(data, s, roleGiver)
 {
 }
コード例 #23
0
 public Courtesan(RoleData data, SimDescription s, IRoleGiver roleGiver)
     : base(data, s, roleGiver)
 {
 }
コード例 #24
0
 public ExoticDancer(RoleData data, SimDescription s, IRoleGiver roleGiver)
     : base(data, s, roleGiver)
 {
 }