private void transferFunds(CAS.SimDescription giver, CAS.SimDescription receiver, int amount) { // Pay sims money by modiyfing each's funds. if (giver.FamilyFunds >= amount) { //test case to make sure recepient doesn't earn more than the giver actually has in funds giver.ModifyFunds(-amount); receiver.ModifyFunds(amount); } else { //Give all of what the sim does have, and send a message to the player. giver.CreatedSim.ShowTNSIfSelectable("I don't have enough money to pay this in full. I can only give what I have.", StyledNotification.NotificationStyle.kSimTalking); giver.ModifyFunds(-giver.FamilyFunds); receiver.ModifyFunds(giver.FamilyFunds); } }
private CAS.SimDescription getSimSelection() { List <PhoneSimPicker.SimPickerInfo> choices = Phone.Call.GetAllValidCallees(base.Actor, 0f, false, true, false, false); //use the in game phone book for possible check recipients List <object> chosen = Sims3.UI.PhoneSimPicker.Show(true, ModalDialog.PauseMode.PauseSimulator, choices, "Choose Recepient", "Send Check", "Cancel"); if (chosen == null) { return(null); } CAS.SimDescription s = null; foreach (object o in chosen) { s = (CAS.SimDescription)o; } return(s); }
protected override bool Run() { if (!base.Actor.RouteToObjectRadius(base.Target, 0.3f)) { return(false); } //move in close to the object and if not possible quit the interaction. if (!CarrySystem.PickUp(base.Actor, base.Target)) { return(false); } //pick up object and then bring it to a surface. CAS.SimDescription receiver = getSimSelection(); if (receiver != null) { String samount = StringInputDialog.Show("Amount:", "(Must be round number) §", "100"); //must parse the string into an integer int amount = 0; if (int.TryParse(samount, out amount) && receiver != null) { transferFunds(base.Actor.SimDescription, receiver, amount); } else { base.Actor.ShowTNSIfSelectable("Woops! Messed up the check...I can't send this one!", StyledNotification.NotificationStyle.kSimTalking); return(false); //exit interaction when user enters invalid value } } else { return(false); } checkAnimation(); //end with animation return(true); //CarrySystem.PutDown(base.Actor, SurfaceType.Normal, true); }
protected override bool Run() { if (base.Actor.Inventory.Contains(base.Target)) { if (!CarrySystem.PickUpFromSimInventory(base.Actor, this.Target)) { return(false); } } else if (!base.Actor.RouteToObjectRadius(base.Target, 0.3f)) { if (!CarrySystem.PickUp(base.Actor, base.Target)) { return(false); } //pick up object and then bring it to a surface. return(false); } //move in close to the object and if not possible quit the interaction. //alternate path depending on whether the checkbook is already in the inventory. //place on surface and then enter the chair placeOnSurface(); /* * if (this.mCheckBookSurface != null) { * SurfaceSlot surfaceSlotFramContainedObject = this.mCheckBookSurface.Surface.GetSurfaceSlotFromContainedObject(this.Target); * this.mChecBookSlot = surfaceSlotFramContainedObject.ContainmentSlot; * Slot chairslot = surfaceSlotFramContainedObject.ChairSlots[0]; * ISittable Chair = (ISittable) mCheckBookSurface.GetContainedObject(chairslot); * InteractionInstance sitOnChair = Chair.RouteToForSitting(base.Actor, chairslot, true,; * //base.Actor.RouteToSlot(this.Target, mChecBookSlot); * ChildUtils.SetPosturePrecondition(this, CommodityKind.Sitting, new CommodityKind[] * { * CommodityKind.InFrontOfSurfaceForTarget, * CommodityKind.ChairScootedIntoSurface * }); * * } * */ CAS.SimDescription receiver = getSimSelection(); if (receiver != null) { String samount = StringInputDialog.Show("Amount:", "(Must be round number) §", "100"); //must parse the string into an integer int amount = 0; if (int.TryParse(samount, out amount) && receiver != null) { transferFunds(base.Actor.SimDescription, receiver, amount); } else { base.Actor.ShowTNSIfSelectable("Woops! Messed up the check...I can't send this one!", StyledNotification.NotificationStyle.kSimTalking); return(false); //exit interaction when user enters invalid value } } else { return(false); } checkAnimation(); //end with animation base.Actor.ShowTNSIfSelectable("Ended animation.", StyledNotification.NotificationStyle.kSimTalking); //CarrySystem.AnimateIntoSimInventory(base.Actor); animation errors out in null. Probably because of table base.Actor.ShowTNSIfSelectable("Ended animate into.", StyledNotification.NotificationStyle.kSimTalking); base.Actor.Inventory.TryToAdd(this.Target); base.Actor.ShowTNSIfSelectable("Ended method", StyledNotification.NotificationStyle.kSimTalking); return(true); //CarrySystem.PutDown(base.Actor, SurfaceType.Normal, true); }