public static void DoRandomIdle(Sim sim, InteractionPriority priority) { //20% chance of doing random idle. int percentage = RandomUtil.GetInt(1, 100); if (percentage <= 50) { string idle; IdleInfo info = null; bool customJazzGraph; ProductVersion version; idle = IdleManager.ChooseTraitIdle(sim.TraitManager.GetRandomVisibleElement().mTraitGuid, Sims3.SimIFace.CAS.CASAgeGenderFlags.Adult, Sims3.SimIFace.CAS.CASAgeGenderFlags.Female, out customJazzGraph, out version); foreach (IdleAnimationInfo item in IdleManager.sTraitIdleAnimations.Values) { if (item.Animations != null) { info = item.Animations.Find(delegate(IdleInfo i) { return(!string.IsNullOrEmpty(i.AnimationName) && i.AnimationName.Equals(idle)); }); } if (info != null) { break; } } if (info != null) { // CommonMethodsOFBBistroSet.PrintMessage(info.AnimationName); Sim.PlayAnim(sim, info.AnimationName); } } else { sim.IdleManager.PlayOneFacialIdle(); } }