private static void AddTendInteractions(BarProfessional bar) { bar.RemoveInteractionByType(TendHomeBar.Singleton); bar.AddInteraction(TendHomeBar.Singleton); bar.RemoveInteractionByType(MakeBusinessBar.Singleton); bar.AddInteraction(MakeBusinessBar.Singleton); }
protected static ListenerAction OnObjectBought(Event e) { if (e != null) { BarProfessional door = e.TargetObject as BarProfessional; if (door != null) { AddTendInteractions(door); } } return(ListenerAction.Keep); }
private bool isBarManned(BarProfessional bar) { if (bar.InUse) { List <Sim> users = bar.ActorsUsingMe; foreach (Sim user in users) { if (user == bar.GetBartender()) { return(true); } } } return(false); }
public override bool Run() { try { base.StandardEntry(false); base.BeginCommodityUpdates(); base.AcquireStateMachine("BarProfessional", AnimationPriority.kAPCarryRightPlus); base.SetActorAndEnter("x", this.Actor, "Enter"); Bartending.SetGlassActor(this.mCurrentStateMachine, this.Target); Posture posture = this.Actor.Posture; if (posture is SimCarryingObjectPosture) { posture = posture.PreviousPosture; } BarProfessional.SetSeatedParameter(this.Actor, this.mCurrentStateMachine); //string reactionNameForDrink = Bartending.GetReactionNameForDrink(this.Actor, this.Target.ContainedDrink); //base.AnimateSim(reactionNameForDrink); this.Target.TakeSip(this.Actor); //if (Bartending.IsReactionNaseous(reactionNameForDrink)) //{ // this.Actor.BuffManager.AddElement(BuffNames.Nauseous, Origin.FromJuice); // base.SetParameter("isCarryingGlass", false); // CarrySystem.ExitAndKeepHolding(this.Actor); // base.DestroyObject(this.Target); // Glass.PopPosture(this.Actor); //} //else //{ StyledNotification.Show(new StyledNotification.Format("drinking: " + base.Target.mTotalSips + " glass empty " + this.Target.IsEmpty(), StyledNotification.NotificationStyle.kGameMessagePositive)); base.SetParameter("isCarryingGlass", true); if (this.Target.IsEmpty())//|| Bartending.IsReactionNegative(reactionNameForDrink)) { StyledNotification.Show(new StyledNotification.Format("glass empty, exit ", StyledNotification.NotificationStyle.kGameMessagePositive)); this.Target.OnDrinkFinished(this.Actor); Glass.PutAwayAndPop(this.Actor); } //} base.AnimateSim("Exit"); base.EndCommodityUpdates(true); base.StandardExit(false, false); } catch (System.Exception ex) { StyledNotification.Show(new StyledNotification.Format(ex.Message, StyledNotification.NotificationStyle.kGameMessageNegative)); } return(true); }
protected ListenerAction OnObjectBought(Event e) { BarProfessional bar = e.TargetObject as BarProfessional; if (bar != null) { AddOrderInteractionToBar(bar); } Microwave micro = e.TargetObject as Microwave; if (micro != null) { AddWarmupInteractionToMicrowave(micro); } return(ListenerAction.Keep); }
public bool RunPaymentBehavior(out int tipAmount) { tipAmount = 0; Sim instanceActor = this.LinkedInteractionInstance.InstanceActor; int num = BarProfessional.GetCost(DrinkDescription, this.Target.LotCurrent.GetMetaAutonomyType, this.Actor, this.Target, true) * 1; if (num == 0) { return(true); } float celebrityDiscount = this.Actor.CelebrityManager.GetCelebrityDiscount(true); tipAmount = GetTipAmount(this.Actor, instanceActor, this.Target.LotCurrent.GetMetaAutonomyType, DrinkDescription); if (Bartending.HasTabOpen(this.Actor, this.Target.LotCurrent)) { Bartending.AddToTab(this.Target.LotCurrent, num); if (this.Actor.IsSelectable) { this.Actor.ModifyFunds(-tipAmount); } } else { if (this.Actor.IsSelectable) { if (num > this.Actor.FamilyFunds) { this.Actor.ShowTNSIfSelectable(BarProfessional.LocalizeString(this.Actor.IsFemale, "CantPayForDrink", new object[0]), StyledNotification.NotificationStyle.kSimTalking, instanceActor.ObjectId, this.Actor.ObjectId); return(false); } int cost = num + tipAmount; if (!CelebrityManager.TryModifyFundsWithCelebrityDiscount(this.Actor, this.Target, cost, celebrityDiscount, true)) { return(false); } } } return(true); }
public void PushRoleStartingInteraction(Actors.Sim sim) { try { //Message.Sender.Show("PushRoleStartingInteraction to " + (sim != null ? sim.FullName : "null")); if (sim != null) { if (sim.LotCurrent == null || sim.LotCurrent != this.LotCurrent) { HomeBartender.forceSimToLot(sim); } else { LetSimIn(sim); List <BarProfessional> bars = this.LotCurrent.GetObjectsInRoom <BarProfessional>(this.RoomId); BarProfessional theBar = null; foreach (BarProfessional bar in bars) { if (!isBarManned(bar)) { theBar = bar; break; } } if (theBar != null) { InteractionInstance instance = TendHomeBar.Singleton.CreateInstance(theBar, sim, new InteractionPriority(InteractionPriorityLevel.CriticalNPCBehavior), false, false); sim.InteractionQueue.AddAfterCheckingForDuplicates(instance); } } } } catch (Exception ex) { } }
private static void AddOrderInteractionToBar(BarProfessional bar) { bar.AddInteraction(OrderTrueBlood.Singleton); }
private bool isBarManned(BarProfessional bar) { if (bar.InUse) { List<Sim> users = bar.ActorsUsingMe; foreach (Sim user in users) { if (user == bar.GetBartender()) { return true; } } } return false; }