private bool TryDeductFunds(TattooChair ths, Sim giver, Sim receiver) { if (giver == receiver) { if (giver.FamilyFunds >= Tattooing.kCostTattooSelf) { receiver.ModifyFunds(-Tattooing.kCostTattooSelf); return(true); } return(false); } if (giver == ths.GetTattooArtist()) { if (!CelebrityManager.TryModifyFundsWithCelebrityDiscount(receiver, giver, Tattooing.kCostTattooFromTattooArtist, true)) { return(false); } return(true); } if (!CelebrityManager.TryModifyFundsWithCelebrityDiscount(receiver, giver, Tattooing.kCostTattooFromSim, true)) { return(false); } return(true); }
private bool TryDeductFunds(TattooChair ths, Sim giver, Sim receiver) { if (giver == receiver) { if (giver.FamilyFunds >= Tattooing.kCostTattooSelf) { receiver.ModifyFunds(-Tattooing.kCostTattooSelf); return true; } return false; } if (giver == ths.GetTattooArtist()) { if (!CelebrityManager.TryModifyFundsWithCelebrityDiscount(receiver, giver, Tattooing.kCostTattooFromTattooArtist, true)) { return false; } return true; } if (!CelebrityManager.TryModifyFundsWithCelebrityDiscount(receiver, giver, Tattooing.kCostTattooFromSim, true)) { return false; } return true; }
private new void OnDisplayCas() { try { if (!Target.Repairable.Broken && (Target.Upgradable.Inkinization || !RandomUtil.RandomChance01(Tattooing.GetChanceOfFailure(Actor, Actor)))) { if (Target.TryDeductFunds(Actor, Actor)) { bool tookSemaphore = mTookSemaphore; GiveTattooEx.DisplayCAS(Actor, ref tookSemaphore); mTookSemaphore = tookSemaphore; EventTracker.SendEvent(EventTypeId.kGotTattoo, Actor); } } else { TattooChair.AddFailureTattoo(Actor); EventTracker.SendEvent(EventTypeId.kGotTattoo, Actor); Actor.ShowTNSIfSelectable(TattooChair.LocalizeString("FailureTnsSelf", new object[] { Actor }), StyledNotification.NotificationStyle.kGameMessageNegative, Target.ObjectId, Actor.ObjectId); } } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); } }
public override bool Run() { try { AlarmHandle handle; float kTimeToRemoveTattoos; if (!Target.RouteToChairControls(Actor)) { return(false); } if (!StartSync(true)) { return(false); } Actor.LoopIdle(); Actor.SkillManager.AddElement(SkillNames.Tattooing); StandardEntry(); BeginCommodityUpdates(); Sim instanceActor = LinkedInteractionInstance.InstanceActor; Target.OnStartTattooing(instanceActor); AcquireStateMachine(Target.StateMachineName, AnimationPriority.kAPNormalPlus); SetActorAndEnter(Target.ActorForTattooer, Actor, "Enter"); SetActor("tattooChair", Target); SetActor(Target.ActorForTattooed, instanceActor); SetParameter("isScared", TattooChair.ShouldPlayScaredReaction(instanceActor)); AddPersistentScriptEventHandler(0x0, new SacsEventHandler(Target.OnSound)); EnterState(Target.ActorForTattooed, "Enter"); AnimateSim("Tattoo"); kTimeToRemoveTattoos = Tattooing.GetTimeToTattoo(Actor); handle = Target.AddAlarm(kTimeToRemoveTattoos * TattooChair.kTimeAtWhichToPerformAction, TimeUnit.Minutes, OnDisplayCas, "Tattoo Chair - Display Cas", AlarmType.DeleteOnReset); bool succeeded = DoTimedLoop(kTimeToRemoveTattoos); if (!succeeded) { Target.RemoveAlarm(handle); } AnimateSim("Exit"); FinishLinkedInteraction(true); EndCommodityUpdates(succeeded); StandardExit(); WaitForSyncComplete(); Target.Repairable.UpdateBreakage(Actor.IsSelectable ? Actor : instanceActor); return(succeeded); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); return(false); } }
private new void OnDisplayCas() { try { Sim instanceActor = LinkedInteractionInstance.InstanceActor; if (instanceActor == null) { return; } bool flag = !Target.Repairable.Broken && (Target.Upgradable.Inkinization || !RandomUtil.RandomChance01(Tattooing.GetChanceOfFailure(Actor, instanceActor))); if (!flag) { Sim actor = instanceActor; ObjectGuid choice = ObjectGuid.InvalidObjectGuid; if (Actor.IsSelectable) { actor = Actor; choice = instanceActor.ObjectId; } if (instanceActor.IsSelectable || Actor.IsSelectable) { TattooChair.AddFailureTattoo(instanceActor); } actor.ShowTNSIfSelectable(TattooChair.LocalizeString("FailureTns" + RandomUtil.GetInt(0x2), new object[0x0]), StyledNotification.NotificationStyle.kSimTalking, Actor.ObjectId, choice); } else if ((Actor.IsSelectable || instanceActor.IsSelectable) && TryDeductFunds(Target, Actor, instanceActor)) { bool tookSemaphore = mTookSemaphore; DisplayCAS(instanceActor, ref tookSemaphore); mTookSemaphore = tookSemaphore; EventTracker.SendEvent(EventTypeId.kGotTattoo, instanceActor); } ActiveTopic.AddToSim(instanceActor, "Got a Tattoo"); (LinkedInteractionInstance as TattooChair.GetTattoo).IsSuccess = flag; } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); } }
public override bool Run() { try { if (!Target.RouteToChairControls(Actor)) { return(false); } EnterStateMachine(Target.StateMachineName, "Enter", "x"); SetActor("tattooChair", Target); SetActor("y", Actor); AnimateSim("Tattoo Self Stand"); AddPersistentScriptEventHandler(0x0, new SacsEventHandler(Target.OnSound)); bool succeeded = DoTimedLoop(TattooChair.kTimeToPrepareSelfTattoo); AnimateSim("Exit"); if (!succeeded || !Target.RouteToChair(Actor)) { return(false); } EnterState("x", "Enter"); EnterState("tattooChair", "Enter"); Actor.SkillManager.AddElement(SkillNames.Tattooing); StandardEntry(); BeginCommodityUpdates(); SetParameter("isScared", TattooChair.ShouldPlayScaredReaction(Actor)); AnimateSim("Tattoo Self"); float timeToTattoo = Tattooing.GetTimeToTattoo(Actor); AlarmHandle handle = Target.AddAlarm(timeToTattoo * TattooChair.kTimeAtWhichToPerformAction, TimeUnit.Minutes, new AlarmTimerCallback(OnDisplayCas), "Tattoo Chair - Display Cas", AlarmType.DeleteOnReset); succeeded = DoTimedLoop(timeToTattoo); if (!succeeded) { Target.RemoveAlarm(handle); } AnimateSim("Exit"); Target.Repairable.UpdateBreakage(Actor); EndCommodityUpdates(succeeded); StandardExit(); return(succeeded); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); return(false); } }