public static void UnSpoil(OFBStand stand) { foreach (var stack in stand.Inventory.InventoryItems.Values) { foreach (var item in stack.List) { if (item.Object.Value == 0) { ServingContainer single = item.Object as ServingContainer; ServingContainerGroup group = item.Object as ServingContainerGroup; int servingPrice = stand.info.ServingPrice; if (group != null) { group.mPurchasedPrice = ReturnPriceByQuality(single.FoodQuality, servingPrice * group.NumServingsLeft); group.RemoveSpoilageAlarm(); } else if (single != null) { single.mPurchasedPrice = ReturnPriceByQuality(single.FoodQuality, servingPrice); single.RemoveSpoilageAlarm(); } } } } }
public static void UnSpoil(StoreSetRegister register, StoreSetBase storebase, ani_StoreRug rug, int servingPrice) { foreach (var stack in register.Inventory.InventoryItems.Values) { if (register != null) { foreach (var item in stack.List) { // if (item.Object.Value == 0) { ServingContainer single = item.Object as ServingContainer; ServingContainerGroup group = item.Object as ServingContainerGroup; if (group != null) { group.mPurchasedPrice = ReturnPriceByQuality(single.FoodQuality, servingPrice * group.NumServingsLeft); group.RemoveSpoilageAlarm(); } else if (single != null) { single.mPurchasedPrice = ReturnPriceByQuality(single.FoodQuality, servingPrice); single.RemoveSpoilageAlarm(); } } } } //if (rug != null) //{ // List<ObjectGuid> objectsICanBuyInDisplay = rug.GetObjectsICanBuyInDisplay(null); // for (int i = 0; i < objectsICanBuyInDisplay.Count; i++) // { // GameObject gameObject = GlobalFunctions.ConvertGuidToObject<GameObject>(objectsICanBuyInDisplay[i]); // if (gameObject != null) // { // CMStoreSet.PrintMessage(gameObject.GetType().ToString()); // if (gameObject.GetType() == typeof(ServingContainerGroup) || gameObject.GetType() == typeof(ServingContainerSingle)) // { // CMStoreSet.PrintMessage("start unspoiling"); // ServingContainer single = gameObject as ServingContainer; // ServingContainerGroup group = gameObject as ServingContainerGroup; // if (group != null) // { // group.mPurchasedPrice = ReturnPriceByQuality(single.FoodQuality, servingPrice * group.NumServingsLeft); // group.RemoveSpoilageAlarm(); // } // else if (single != null) // { // single.mPurchasedPrice = ReturnPriceByQuality(single.FoodQuality, servingPrice); // single.RemoveSpoilageAlarm(); // } // } // } // } //} } }
/// <summary> /// /// </summary> /// <param name="obj"></param> /// <returns></returns> public static float ReturnItemPrice(GameObject obj) { bool isFood = false; float objectValue = (float)obj.Value; SimDescription productMaker = CommonMethods.ReturnCreaotrSimDescription(obj); //Food has no value by default if (objectValue == 0) { ServingContainer pf = obj as ServingContainer; if (pf != null) { //Set price depending on quality pf.RemoveSpoilageAlarm(); // StyledNotification.Show(new StyledNotification.Format(pf.Cost + " " + pf.FoodQuality, StyledNotification.NotificationStyle.kGameMessagePositive)); isFood = true; switch (pf.FoodQuality) { case Quality.Foul: case Quality.Horrifying: case Quality.Bad: case Quality.Putrid: objectValue = AddMenuItem.ReturnFoodPriceBad(); break; case Quality.Nice: case Quality.VeryNice: objectValue = AddMenuItem.ReturnFoodPriceNice(); break; case Quality.Great: case Quality.Outstanding: case Quality.Excellent: objectValue = AddMenuItem.ReturnFoodPriceGreat(); break; case Quality.Perfect: objectValue = AddMenuItem.ReturnFoodPricePerfect(); break; default: objectValue = AddMenuItem.ReturnFoodPriceDefault(); break; } } } //If the product has no maker, multiply by 1.3 float priceIncrease = objectValue * (1 + (float)AddMenuItem.ReturnProfitForNoneGrownGoods() / 100); if (productMaker == null && !isFood) { if (priceIncrease < (objectValue + 1)) { objectValue += 1; } else { objectValue = priceIncrease; } } else if (obj.GetType() == typeof(Ingredient)) { objectValue *= (1 + (float)AddMenuItem.ReturnProfitForIngredients() / 100); } return(objectValue); }