public override bool Test(Sim actor, BarProfessional target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { SimDescription theActor = actor.SimDescription; if (theActor != null) { if (theActor.IsVampire == false) { return(false); } } if (!target.IsBartenderAvailable()) { return(false); } if (actor == target.mBartender) { return(false); } if (target.LotCurrent.IsResidentialLot) { return(false); } if (isAutonomous) { if (BarProfessional.IsRunningBarInteraction(actor)) { return(false); } if (target.mBartender != null && !Bartending.CanWorkAsBartendender(target.mBartender, target.LotCurrent, true)) { return(false); } if (Bartending.HasTabOpen(actor, target.LotCurrent)) { return(false); } } if (DrinkDescription != null) { int num = BarProfessional.GetCost(DrinkDescription, target.LotCurrent.GetMetaAutonomyType, actor, target) * 1; if (num > actor.FamilyFunds) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(BarProfessional.LocalizeString("NotEnoughMoney", new object[0])); return(false); } } return(true); }
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); }