public Definition(ObjectGuid target, int cost, bool usePath) { this.mPath = new string[] { CraftersConsignment.LocalizeString(false, "PurchasePath", new object[0]) + Localization.Ellipsis }; this.mObject = target; this.mCost = cost; this.mUsePath = usePath; }
public override bool Test(Sim a, CraftersConsignment target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if (mObject == ObjectGuid.InvalidObjectGuid) { return((!isAutonomous || !a.IsSelectable) && DisplayHelper.GetObjectsICanBuyInDisplay(a, target).Count > 0); } return(base.Test(a, target, isAutonomous, ref greyedOutTooltipCallback)); }
public override bool Test(Sim a, CraftersConsignment target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if (target.Charred) { return(false); } if (DisplayHelper.GetObjectsICanBuyInDisplay(a, target).Count == 0) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(CraftersConsignment.LocalizeString(a.IsFemale, "NothingOnDisplay", new object[0])); return(false); } return(true); }
public override string GetInteractionName(Sim actor, CraftersConsignment target, InteractionObjectPair iop) { GameObject obj2 = GlobalFunctions.ConvertGuidToObject <GameObject>(this.mObject); if (obj2 == null) { return(CraftersConsignment.LocalizeString(actor.IsFemale, "Buy", new object[0])); } ServingContainer container = obj2 as ServingContainer; if (container != null) { return(CraftersConsignment.LocalizeString(actor.IsFemale, "BuyObjectForCost", new object[] { container.CookingProcess.RecipeNameFinal, this.mCost })); } return(CraftersConsignment.LocalizeString(actor.IsFemale, "BuyObjectForCost", new object[] { obj2.CatalogName, this.mCost })); }
public override void AddInteractions(InteractionObjectPair iop, Sim actor, IGameObject target, List <InteractionObjectPair> results) { CraftersConsignment targetObject = null; if (this.mParentRug != ObjectGuid.InvalidObjectGuid) { targetObject = GlobalFunctions.ConvertGuidToObject <CraftersConsignment>(this.mParentRug); } for (IGameObject obj2 = target.Parent; (targetObject == null) && (obj2 != null); obj2 = obj2.Parent) { targetObject = obj2 as CraftersConsignment; } if ((targetObject != null) && DisplayHelper.GetObjectsICanBuyInDisplay(actor, targetObject).Contains(target.ObjectId)) { results.Add(new InteractionObjectPair(new PurchaseItemEx.Definition(target.ObjectId, DisplayHelper.ComputeFinalPriceOnObject(target.ObjectId), false), targetObject)); } }
public static int BasePriceFinalPriceDiff(GameObject obj, bool singleServingOnly, out int FinalPrice, out int BasePrice) { CraftersConsignment display = obj.Parent as CraftersConsignment; if (display == null) { BasePrice = 0; FinalPrice = 0; return(0); } BasePrice = 0; if (obj != null) { ServingContainer container = obj as ServingContainer; if (container != null) { float kSingleServingBasePrice = 0f; if (singleServingOnly || container is ISingleServingContainer) { kSingleServingBasePrice = CraftersConsignment.kSingleServingBasePrice; } else { kSingleServingBasePrice = CraftersConsignment.kGroupServingBasePrice; } kSingleServingBasePrice *= CraftersConsignment.kFoodQualityMuliplier[QualityHelper.GetQualityIndex(container.GetQuality())]; BasePrice = (int)kSingleServingBasePrice; } Snack snackContainer = obj as Snack; if (snackContainer != null) { float kSingleServingBasePrice = CraftersConsignment.kSingleServingBasePrice; kSingleServingBasePrice *= CraftersConsignment.kFoodQualityMuliplier[QualityHelper.GetQualityIndex(Quality.Perfect)]; BasePrice = (int)kSingleServingBasePrice; } } float num2 = CraftersConsignment.ConvertMarkupToPercent(display.mMarkup); float num3 = ((float)BasePrice) * num2; num3 -= num3 * display.mSaleDiscount; FinalPrice = (int)num3; return(BasePrice - FinalPrice); }
public static List <ObjectGuid> GetObjectsICanBuyInDisplay(Sim actor, CraftersConsignment display) { List <ObjectGuid> list = new List <ObjectGuid>(); if (!display.Charred) { Slot[] containmentSlots = display.GetContainmentSlots(); for (int i = 0; i < containmentSlots.Length; i++) { GameObject containedObject = display.GetContainedObject(containmentSlots[i]) as GameObject; if (TestIfObjectCanBeBoughtByActor(containedObject, actor)) { list.Add(containedObject.ObjectId); } } } return(list); }
public override void AddInteractions(InteractionObjectPair iop, Sim actor, IGameObject target, List <InteractionObjectPair> results) { CraftersConsignment targetObject = null; if (this.mParentRug != ObjectGuid.InvalidObjectGuid) { targetObject = GlobalFunctions.ConvertGuidToObject <CraftersConsignment>(this.mParentRug); } for (IGameObject obj2 = target.Parent; (targetObject == null) && (obj2 != null); obj2 = obj2.Parent) { targetObject = obj2 as CraftersConsignment; } if ((targetObject != null) && DisplayHelper.TestIfObjectCanBeBoughtByActor(target, actor)) //DisplayHelper.GetObjectsICanBuyInDisplay(actor, targetObject).Contains(target.ObjectId)) { ServingContainerGroup groupServing = target as ServingContainerGroup; if (groupServing != null) { results.Add(new InteractionObjectPair(new PurchaseItemEx.Definition(groupServing, true), targetObject)); results.Add(new InteractionObjectPair(new PurchaseItemEx.Definition(groupServing, false), targetObject)); return; } results.Add(new InteractionObjectPair(new PurchaseItemEx.Definition(target.ObjectId, false), targetObject)); } }
public override void AddInteractions(InteractionObjectPair iop, Sim actor, CraftersConsignment target, List<InteractionObjectPair> results) { List<ObjectGuid> objectsICanBuyInDisplay = DisplayHelper.GetObjectsICanBuyInDisplay(actor, target); bool usePath = objectsICanBuyInDisplay.Count != 1; foreach (ObjectGuid objectGuid in objectsICanBuyInDisplay) { ServingContainerGroup groupServing = GlobalFunctions.ConvertGuidToObject<ServingContainerGroup>(objectGuid); if (groupServing != null) { results.Add(new InteractionObjectPair(new Definition(groupServing, true), iop.Target, iop.Tuning)); results.Add(new InteractionObjectPair(new Definition(groupServing, false), iop.Target, iop.Tuning)); continue; } results.Add(new InteractionObjectPair(new Definition(objectGuid, usePath), iop.Target, iop.Tuning)); } }
public override bool Test(Sim a, CraftersConsignment target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if (target.Charred) { return false; } if (DisplayHelper.GetObjectsICanBuyInDisplay(a, target).Count == 0) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(CraftersConsignment.LocalizeString(a.IsFemale, "NothingOnDisplay", new object[0])); return false; } return true; }
public override string GetInteractionName(Sim actor, CraftersConsignment target, InteractionObjectPair iop) { return base.GetInteractionName(actor, target, new InteractionObjectPair(sOldSingleton, target)); }
public static List<ObjectGuid> GetObjectsICanBuyInDisplay(Sim actor, CraftersConsignment display) { List<ObjectGuid> list = new List<ObjectGuid>(); if (!display.Charred) { Slot[] containmentSlots = display.GetContainmentSlots(); for (int i = 0; i < containmentSlots.Length; i++) { GameObject containedObject = display.GetContainedObject(containmentSlots[i]) as GameObject; if (TestIfObjectCanBeBoughtByActor(containedObject, actor)) { list.Add(containedObject.ObjectId); } } } return list; }
public override bool Run() { if (!base.Actor.RouteToObjectRadialRange(base.Target, 0f, base.Target.MaxProximityBeforeSwiping())) { //Honestly just plain annoying to watch, especially since sims love this interaction so much //base.Actor.PlayRouteFailure(); return(false); } base.Actor.RouteTurnToFace(base.Target.Position); base.StandardEntry(); base.BeginCommodityUpdates(); List <ObjectGuid> objectsICanBuyInDisplay = DisplayHelper.GetObjectsICanBuyInDisplay(base.Actor, base.Target); RandomUtil.RandomizeListOfObjects <ObjectGuid>(objectsICanBuyInDisplay); for (int i = 0; base.Actor.HasNoExitReason() && (i < objectsICanBuyInDisplay.Count); i++) { ObjectGuid guid = objectsICanBuyInDisplay[i]; GameObject target = GlobalFunctions.ConvertGuidToObject <GameObject>(guid); if (target != null) { base.Actor.RouteTurnToFace(target.Position); int priority = 100; base.Actor.LookAtManager.SetInteractionLookAt(target, priority, LookAtJointFilter.HeadBones | LookAtJointFilter.TorsoBones); bool flag = RandomUtil.RandomChance01(CraftersConsignment.kBrowseChanceOfDislikingObject); ThoughtBalloonManager.BalloonData bd = new ThoughtBalloonManager.BalloonData(target.GetThumbnailKey()); if (flag) { bd.LowAxis = ThoughtBalloonAxis.kDislike; } base.Actor.ThoughtBalloonManager.ShowBalloon(bd); string state = "1"; if (flag) { state = RandomUtil.GetRandomStringFromList(new string[] { "3", "5", "CantStandArtTraitReaction" }); } else { state = RandomUtil.GetRandomStringFromList(new string[] { "0", "1", "2" }); } base.EnterStateMachine("viewobjectinteraction", "Enter", "x"); base.AnimateSim(state); base.AnimateSim("Exit"); base.Actor.LookAtManager.ClearInteractionLookAt(); } } if (base.Autonomous && !base.Actor.IsSelectable) { float chance = CraftersConsignment.kBrowseBaseChanceOfBuyingObjectWithoutSale + base.Target.mSaleDiscount; if (RandomUtil.RandomChance01(chance)) { List <ObjectGuid> randomList = DisplayHelper.GetObjectsICanBuyInDisplay(base.Actor, base.Target); if (randomList.Count > 0) { ObjectGuid randomObjectFromList = RandomUtil.GetRandomObjectFromList <ObjectGuid>(randomList); if (randomObjectFromList != ObjectGuid.InvalidObjectGuid) { PurchaseItemEx.Definition continuationDefinition = null; if (Actor.Motives.IsHungry()) { PreparedFood food = GlobalFunctions.ConvertGuidToObject <PreparedFood>(randomObjectFromList); if (food != null) { continuationDefinition = new PurchaseItemEx.BuyFoodDefinition(food); } } if (continuationDefinition == null) { continuationDefinition = new PurchaseItemEx.Definition(randomObjectFromList, false); } base.TryPushAsContinuation(continuationDefinition); } } } } if (!base.Autonomous) { List <ObjectGuid> list3 = DisplayHelper.GetObjectsICanBuyInDisplay(base.Actor, base.Target); if (objectsICanBuyInDisplay.Count > 0) { StringBuilder builder = new StringBuilder(); builder.AppendLine(CraftersConsignment.LocalizeString(base.Actor.IsFemale, "BrowseItemsForPurchaseHeading", new object[0])); for (int j = 0; j < list3.Count; j++) { GameObject obj3 = GlobalFunctions.ConvertGuidToObject <GameObject>(list3[j]); if (obj3 != null) { ServingContainer container = obj3 as ServingContainer; if (container != null) { builder.AppendLine(CraftersConsignment.LocalizeString(base.Actor.IsFemale, "BrowseLineItem", new object[] { container.CookingProcess.RecipeNameFinal, DisplayHelper.ComputeFinalPriceOnObject(list3[j]) })); } else { Common.Notify("BrowseEx for " + obj3.CatalogName); builder.AppendLine(CraftersConsignment.LocalizeString(base.Actor.IsFemale, "BrowseLineItem", new object[] { obj3.CatalogName, DisplayHelper.ComputeFinalPriceOnObject(list3[j]) })); } } } base.Actor.ShowTNSIfSelectable(builder.ToString(), StyledNotification.NotificationStyle.kGameMessagePositive); } } base.EndCommodityUpdates(true); base.StandardExit(); return(true); }
public override string GetInteractionName(Sim actor, CraftersConsignment target, InteractionObjectPair iop) { GameObject obj2 = GlobalFunctions.ConvertGuidToObject<GameObject>(this.mObject); if (obj2 == null) { return CraftersConsignment.LocalizeString(actor.IsFemale, "Buy", new object[0]); } ServingContainer container = obj2 as ServingContainer; if (container != null) { return CraftersConsignment.LocalizeString(actor.IsFemale, "BuyObjectForCost", new object[] { container.CookingProcess.RecipeNameFinal, this.mCost }); } return CraftersConsignment.LocalizeString(actor.IsFemale, "BuyObjectForCost", new object[] { obj2.CatalogName, this.mCost }); }
public override void AddInteractions(InteractionObjectPair iop, Sim actor, CraftersConsignment target, List <InteractionObjectPair> results) { List <ObjectGuid> objectsICanBuyInDisplay = DisplayHelper.GetObjectsICanBuyInDisplay(actor, target); if (objectsICanBuyInDisplay.Count == 1) { PreparedFood food = GlobalFunctions.ConvertGuidToObject <PreparedFood>(objectsICanBuyInDisplay[0]); if (food != null) { results.Add(new InteractionObjectPair(new BuyFoodDefinition(food), iop.Target, iop.Tuning)); } } else if (objectsICanBuyInDisplay.Count > 0) { results.Add(iop); } }
public override void AddInteractions(InteractionObjectPair iop, Sim actor, CraftersConsignment target, List <InteractionObjectPair> results) { List <ObjectGuid> objectsICanBuyInDisplay = DisplayHelper.GetObjectsICanBuyInDisplay(actor, target); bool usePath = objectsICanBuyInDisplay.Count != 1; foreach (ObjectGuid objectGuid in objectsICanBuyInDisplay) { ServingContainerGroup groupServing = GlobalFunctions.ConvertGuidToObject <ServingContainerGroup>(objectGuid); if (groupServing != null) { results.Add(new InteractionObjectPair(new Definition(groupServing, true), iop.Target, iop.Tuning)); results.Add(new InteractionObjectPair(new Definition(groupServing, false), iop.Target, iop.Tuning)); continue; } results.Add(new InteractionObjectPair(new Definition(objectGuid, usePath), iop.Target, iop.Tuning)); } }
public Definition() { this.mPath = new string[] { CraftersConsignment.LocalizeString(false, "PurchasePath", new object[0]) + Localization.Ellipsis }; }
public override bool Run() { Definition interactionDefinition = base.InteractionDefinition as Definition; if (interactionDefinition == null) { return(false); } ObjectGuid mObject = interactionDefinition.mObject; if (((mObject == ObjectGuid.InvalidObjectGuid) && base.Autonomous) && !base.Actor.IsSelectable) { List <ObjectGuid> objectsICanBuyInDisplay = DisplayHelper.GetObjectsICanBuyInDisplay(base.Actor, base.Target); RandomUtil.RandomizeListOfObjects <ObjectGuid>(objectsICanBuyInDisplay); int familyFunds = base.Actor.FamilyFunds; for (int i = 0; i < objectsICanBuyInDisplay.Count; i++) { int cost = DisplayHelper.ComputeFinalPriceOnObject(objectsICanBuyInDisplay[i]); if (cost <= familyFunds) { Definition continuationDefinition = new Definition(objectsICanBuyInDisplay[i], cost, objectsICanBuyInDisplay.Count != 1); base.TryPushAsContinuation(continuationDefinition); return(true); } } return(false); } if (mObject == ObjectGuid.InvalidObjectGuid) { return(false); } if (!base.Actor.RouteToObjectRadialRange(base.Target, 0f, base.Target.MaxProximityBeforeSwiping())) { return(false); } base.Actor.RouteTurnToFace(base.Target.Position); if (!DisplayHelper.GetObjectsICanBuyInDisplay(base.Actor, base.Target).Contains(mObject)) { return(false); } if (base.Actor.FamilyFunds < interactionDefinition.mCost) { return(false); } GameObject target = GlobalFunctions.ConvertGuidToObject <GameObject>(mObject); if (target == null) { return(false); } base.StandardEntry(); base.BeginCommodityUpdates(); string swipeAnimationName = base.Target.GetSwipeAnimationName(target); base.Actor.PlaySoloAnimation(swipeAnimationName, true); VisualEffect effect = VisualEffect.Create(base.Target.GetSwipeVfxName()); Vector3 zero = Vector3.Zero; Vector3 axis = Vector3.Zero; if (Slots.AttachToBone(effect.ObjectId, base.Target.ObjectId, ResourceUtils.HashString32("transformBone"), false, ref zero, ref axis, 0f) == TransformParentingReturnCode.Success) { effect.SetAutoDestroy(true); effect.Start(); } else { effect.Dispose(); effect = null; } bool flag = false; bool flag2 = false; if (((target.IsLiveDraggingEnabled() && !target.InUse) && ((target.ItemComp != null) && target.ItemComp.CanAddToInventory(base.Actor.Inventory))) && (base.Actor.Inventory.CanAdd(target) && base.Actor.Inventory.TryToAdd(target))) { flag = true; } else if (!target.InUse && base.Actor.Household.SharedFamilyInventory.Inventory.TryToAdd(target)) { flag2 = true; } bool succeeded = flag || flag2; if (succeeded) { if (flag2) { base.Actor.ShowTNSIfSelectable(CraftersConsignment.LocalizeString(base.Actor.IsFemale, "PlacedInFamilyInventory", new object[] { base.Actor, target }), StyledNotification.NotificationStyle.kGameMessagePositive); } else { base.Actor.ShowTNSIfSelectable(CraftersConsignment.LocalizeString(base.Actor.IsFemale, "PlacedInPersonalInventory", new object[] { base.Actor, target }), StyledNotification.NotificationStyle.kGameMessagePositive); } base.Target.GiveMarkupBuffs(base.Actor, interactionDefinition.mObject); base.Actor.ModifyFunds(-interactionDefinition.mCost); base.Target.GiveLotOwnerMoney(interactionDefinition.mCost, base.Actor); base.Target.AccumulateRevenue(interactionDefinition.mCost); } base.EndCommodityUpdates(succeeded); base.StandardExit(); return(succeeded); }
public override void AddInteractions(InteractionObjectPair iop, Sim actor, CraftersConsignment target, List <InteractionObjectPair> results) { List <ObjectGuid> objectsICanBuyInDisplay = DisplayHelper.GetObjectsICanBuyInDisplay(actor, target); for (int i = 0; i < objectsICanBuyInDisplay.Count; i++) { results.Add(new InteractionObjectPair(new Definition(objectsICanBuyInDisplay[i], DisplayHelper.ComputeFinalPriceOnObject(objectsICanBuyInDisplay[i]), objectsICanBuyInDisplay.Count != 1), iop.Target)); } }
public Definition(GameObject target, bool singleServing) : base(target.ObjectId, DisplayHelper.ComputeFinalPriceOnObject(target, singleServing), true) { mSingleServing = singleServing; mPath = new string[] { CraftersConsignment.LocalizeString(false, "PurchasePath", new object[0]) + Localization.Ellipsis, Food.GetString(singleServing ? Food.StringIndices.MakeOneSingle : Food.StringIndices.MakeOneGroup) + Localization.Ellipsis }; }
public override bool Test(Sim a, CraftersConsignment target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if (mObject == ObjectGuid.InvalidObjectGuid) { return (!isAutonomous || !a.IsSelectable) && DisplayHelper.GetObjectsICanBuyInDisplay(a, target).Count > 0; } return base.Test(a, target, isAutonomous, ref greyedOutTooltipCallback); }
public override void AddInteractions(InteractionObjectPair iop, Sim actor, CraftersConsignment target, List<InteractionObjectPair> results) { List<ObjectGuid> objectsICanBuyInDisplay = DisplayHelper.GetObjectsICanBuyInDisplay(actor, target); if (objectsICanBuyInDisplay.Count == 1) { PreparedFood food = GlobalFunctions.ConvertGuidToObject<PreparedFood>(objectsICanBuyInDisplay[0]); if (food != null) { results.Add(new InteractionObjectPair(new BuyFoodDefinition(food), iop.Target, iop.Tuning)); } } else if (objectsICanBuyInDisplay.Count > 0) { results.Add(iop); } }
public override void AddInteractions(InteractionObjectPair iop, Sim actor, CraftersConsignment target, List<InteractionObjectPair> results) { List<ObjectGuid> objectsICanBuyInDisplay = DisplayHelper.GetObjectsICanBuyInDisplay(actor, target); for (int i = 0; i < objectsICanBuyInDisplay.Count; i++) { results.Add(new InteractionObjectPair(new Definition(objectsICanBuyInDisplay[i], DisplayHelper.ComputeFinalPriceOnObject(objectsICanBuyInDisplay[i]), objectsICanBuyInDisplay.Count != 1), iop.Target)); } }
public override bool Run() { Definition interactionDefinition = base.InteractionDefinition as Definition; if (interactionDefinition == null) { return(false); } ObjectGuid mObject = interactionDefinition.mObject; int mCost = interactionDefinition.mCost; if (mObject == ObjectGuid.InvalidObjectGuid) { List <ObjectGuid> objectsICanBuyInDisplay = DisplayHelper.GetObjectsICanBuyInDisplay(base.Actor, base.Target); if (!Autonomous && Actor.IsSelectable) { List <ObjectPicker.RowInfo> list = new List <ObjectPicker.RowInfo>(); foreach (ObjectGuid current in objectsICanBuyInDisplay) { GameObject obj = GlobalFunctions.ConvertGuidToObject <GameObject>(current); ObjectPicker.RowInfo item = new ObjectPicker.RowInfo(current, new List <ObjectPicker.ColumnInfo> { new ObjectPicker.ThumbAndTextColumn(obj.GetThumbnailKey(), obj.GetLocalizedName()), new ObjectPicker.MoneyColumn(DisplayHelper.ComputeFinalPriceOnObject(obj, true)) }); list.Add(item); } List <ObjectPicker.HeaderInfo> list2 = new List <ObjectPicker.HeaderInfo>(); List <ObjectPicker.TabInfo> list3 = new List <ObjectPicker.TabInfo>(); list2.Add(new ObjectPicker.HeaderInfo(ShoppingRegister.sLocalizationKey + ":BuyFoodColumnName", ShoppingRegister.sLocalizationKey + ":BuyFoodColumnTooltip", 200)); list2.Add(new ObjectPicker.HeaderInfo("Ui/Caption/Shopping/Cart:Price", "Ui/Tooltip/Shopping/Cart:Price")); list3.Add(new ObjectPicker.TabInfo("", ShoppingRegister.LocalizeString("AvailableFoods"), list)); List <ObjectPicker.RowInfo> list4 = SimplePurchaseDialog.Show(ShoppingRegister.LocalizeString("BuyFoodTitle"), Actor.FamilyFunds, list3, list2, true); if (list4 == null || list4.Count != 1) { return(false); } mObject = (ObjectGuid)list4[0].Item; mCost = ((ObjectPicker.MoneyColumn)list4[0].ColumnInfo[1]).Value; } else { RandomUtil.RandomizeListOfObjects <ObjectGuid>(objectsICanBuyInDisplay); int familyFunds = base.Actor.FamilyFunds; for (int i = 0; i < objectsICanBuyInDisplay.Count; i++) { int cost = DisplayHelper.ComputeFinalPriceOnObject(objectsICanBuyInDisplay[i]); if (cost <= familyFunds) { //Definition continuationDefinition = new Definition(objectsICanBuyInDisplay[i], cost, false); //base.TryPushAsContinuation(continuationDefinition); //return true; mObject = objectsICanBuyInDisplay[i]; mCost = cost; break; } } //return false; } } if (mObject == ObjectGuid.InvalidObjectGuid) { return(false); } if (!base.Actor.RouteToObjectRadialRange(base.Target, 0f, base.Target.MaxProximityBeforeSwiping())) { return(false); } base.Actor.RouteTurnToFace(base.Target.Position); if (!DisplayHelper.GetObjectsICanBuyInDisplay(base.Actor, base.Target).Contains(mObject)) { return(false); } if (base.Actor.FamilyFunds < mCost) { return(false); } GameObject target = GlobalFunctions.ConvertGuidToObject <GameObject>(mObject); if (target == null) { return(false); } base.StandardEntry(); base.BeginCommodityUpdates(); string swipeAnimationName = base.Target.GetSwipeAnimationName(target); if (Actor.SimDescription.Child) { swipeAnimationName = "c" + swipeAnimationName.Substring(1); } base.Actor.PlaySoloAnimation(swipeAnimationName, true); VisualEffect effect = VisualEffect.Create(base.Target.GetSwipeVfxName()); Vector3 zero = Vector3.Zero; Vector3 axis = Vector3.Zero; if (Slots.AttachToBone(effect.ObjectId, base.Target.ObjectId, ResourceUtils.HashString32("transformBone"), false, ref zero, ref axis, 0f) == TransformParentingReturnCode.Success) { effect.SetAutoDestroy(true); effect.Start(); } else { effect.Dispose(); effect = null; } //bool flag = false; //bool flag2 = false; bool succeeded = false; bool addInteractions = true; string tnsKey = null; if (target.IsLiveDraggingEnabled() && !target.InUse && (interactionDefinition.mPushEat || (target.ItemComp != null && target.ItemComp.CanAddToInventory(base.Actor.Inventory) && base.Actor.Inventory.CanAdd(target)))) //&& base.Actor.Inventory.TryToAdd(target))) { ServingContainerGroup groupServing = null; if (interactionDefinition.mSingleServing) { groupServing = target as ServingContainerGroup; if (groupServing != null) { target = groupServing.CookingProcess.CreateSingleServingOfFood(groupServing, true, true); addInteractions = false; } } if (interactionDefinition.mPushEat) { target.SetOpacity(0f, 0f); if (Actor.ParentToRightHand(target)) { succeeded = true; CarrySystem.EnterWhileHolding(Actor, target as ICarryable); } target.FadeIn(); } else if (Actor.Inventory.TryToAdd(target)) { succeeded = true; tnsKey = "PlacedInPersonalInventory"; } if (succeeded) { if (groupServing != null) { groupServing.DecrementServings(); if (groupServing.NumServingsLeft == 0) { groupServing.FadeOut(false, true); } } } else if (groupServing != null && target != null) { target.Destroy(); } } else if (!target.InUse && base.Actor.Household.SharedFamilyInventory.Inventory.TryToAdd(target)) { succeeded = true; tnsKey = "PlacedInFamilyInventory"; } //bool succeeded = flag || flag2; if (succeeded) { if (addInteractions) { Target.OnHandToolChildUnslotted(target, Slot.None); if (target is Snack) { target.AddInteraction(Sims3.Gameplay.Objects.CookingObjects.Eat.Singleton, true); target.AddInteraction(Snack_CleanUp.Singleton, true); } } /*if (flag2) * { * base.Actor.ShowTNSIfSelectable(CraftersConsignment.LocalizeString(base.Actor.IsFemale, "PlacedInFamilyInventory", new object[] { base.Actor, target }), StyledNotification.NotificationStyle.kGameMessagePositive); * } * else * { * base.Actor.ShowTNSIfSelectable(CraftersConsignment.LocalizeString(base.Actor.IsFemale, "PlacedInPersonalInventory", new object[] { base.Actor, target }), StyledNotification.NotificationStyle.kGameMessagePositive); * }*/ if (tnsKey != null) { Actor.ShowTNSIfSelectable(CraftersConsignment.LocalizeString(Actor.IsFemale, tnsKey, new object[] { Actor, target }), StyledNotification.NotificationStyle.kGameMessagePositive); } base.Target.GiveMarkupBuffs(base.Actor, mObject); base.Actor.ModifyFunds(-mCost); base.Target.GiveLotOwnerMoney(mCost, base.Actor); base.Target.AccumulateRevenue(mCost); if (interactionDefinition.mPushEat) { (target as IFoodContainer).PushEatHeldFoodInteraction(Actor); } } base.EndCommodityUpdates(succeeded); base.StandardExit(); return(succeeded); }
public override string GetInteractionName(Sim actor, CraftersConsignment target, InteractionObjectPair iop) { return(base.GetInteractionName(actor, target, new InteractionObjectPair(sOldSingleton, target))); }