public override bool Run() { bool success = base.Run(); WorldType type = GameUtils.GetCurrentWorldType(); bool processPurchase = success; //Don't process for the cashier if (!CommonMethods.IsSociable(base.Actor)) { processPurchase = false; } //Pay the lot owner if (processPurchase && success && base.Actor.IsHoldingAnything()) { int price = AddMenuItem.ReturnCoffeePrice(); //No lot owners abroad if (type != WorldType.Vacation) { CommonMethods.PayLotOwner(base.Actor, base.Target.LotCurrent, price); } householdFunds = 0; //if this happened through "Call for meal" //Removing the price from the active buying Sim needs to be done manually base.Actor.ModifyFunds(-price); } return(success); }
public override bool Run() { bool success = base.Run(); //Pay lot owner WorldType type = GameUtils.GetCurrentWorldType(); if (type != WorldType.Vacation) { bool processPurchase = success; //Don't process for the cashier if (!CommonMethods.IsSociable(base.Actor)) { processPurchase = false; } //Pay the lot owner if (processPurchase) { int price = (int)((householdFunds - base.Actor.Household.FamilyFunds) * (new decimal(AddMenuItem.ReturnProfit()) / 100)); if (price <= 0) { price = 5; } CommonMethods.PayLotOwner(base.Actor, base.Target.LotCurrent, price); householdFunds = 0; } } return(success); }
public static void CalculateBroughtItems(Dictionary <uint, List <ObjectGuid> > inventoryItemStack, Sim sim, GameObject target) { // if (sim.Household.IsActive) { List <ObjectGuid> newItemList = new List <ObjectGuid>(); foreach (IInventoryItemStack item in sim.InventoryComp.InventoryUIModel.InventoryItems) { //new item if (!inventoryItemStack.ContainsKey(item.StackId)) { newItemList.AddRange(item.StackObjects); } else { List <ObjectGuid> foundStack = inventoryItemStack[item.StackId]; //Check stack if (foundStack.Count < item.StackObjects.Count) { List <ObjectGuid> ids = new List <ObjectGuid>(); //Find the objec it foreach (ObjectGuid g in item.StackObjects) { if (!foundStack.Contains(g)) { ids.Add(g); } } if (ids != null && ids.Count > 0) { newItemList.AddRange(ids); } } } } //Loop through the new items int totalPrice = 0; foreach (ObjectGuid g in newItemList) { GameObject itemPurchased = GameObject.GetObject(g); if (itemPurchased != null) { int price = (int)(itemPurchased.Value * (new decimal(AddMenuItem.ReturnProfit()) / 100)); if (price == 0) { price = 1; } totalPrice += price; } } if (newItemList.Count > 0) { CommonMethods.PayLotOwner(sim, target.LotCurrent, totalPrice); } } }
public override bool Run() { StyledNotification.Show(new StyledNotification.Format("RUN", StyledNotification.NotificationStyle.kGameMessageNegative)); bool success = base.Run(); WorldType type = GameUtils.GetCurrentWorldType(); bool processPurchase = success; //Don't process for the cashier if (!CommonMethods.IsSociable(base.Actor)) { processPurchase = false; } StyledNotification.Show(new StyledNotification.Format("After run", StyledNotification.NotificationStyle.kGameMessageNegative)); //Pay the lot owner if (processPurchase && success) { int price = (int)((householdFunds - base.Actor.Household.FamilyFunds) * (new decimal(AddMenuItem.ReturnProfit()) / 100)); if (price <= 0) { price = 5; } StyledNotification.Show(new StyledNotification.Format(base.Actor.Name, StyledNotification.NotificationStyle.kGameMessageNegative)); //No lot owners abroad if (type != WorldType.Vacation) { CommonMethods.PayLotOwner(base.Actor, base.Target.LotCurrent, price); } householdFunds = 0; //if this happened through "Call for meal" //Removing the price from the active buying Sim needs to be done manually if (base.Autonomous) { base.Actor.ModifyFunds(-price); } } return(success); }