public static GameObject ReturnRestocableObjectFromRegister(RestockItem rItem, ObjectGuid registerId) { GameObject restockObject = null; bool continueLooping = true; StoreSetRegister register = CMStoreSet.ReturnRegister(registerId, rItem.LotCurrent); if (register != null) { foreach (var stack in register.Inventory.InventoryItems.Values) { if (!continueLooping) { break; } foreach (var item in stack.List) { ItemType type = RestockItemHelperClass.GetItemType((GameObject)item.Object); if (rItem.info.Type == type) { //Does the name match if (rItem.info.Name.Equals(item.Object.GetLocalizedName())) { restockObject = (GameObject)item.Object; continueLooping = false; break; } } } } } return(restockObject); }
public static void PayWages(Sim clerck, StoreSetRegister register, float startTime, float endTime) { int pay = register.Info.HourlyWage * ((int)(endTime - startTime)); // CMStoreSet.PrintMessage(this.Actor.FullName + " pay : " + pay); SimDescription owner = null; if (register.Info.OwnerId != 0uL) { CMStoreSet.ReturnSim(register.Info.OwnerId); } if (owner == null) { if (!register.Info.PayWhenActive || (register.Info.PayWhenActive && clerck.Household.IsActive)) { clerck.ModifyFunds(pay); } } else if (owner != null && clerck.Household.HouseholdId != owner.Household.HouseholdId) { if (!register.Info.PayWhenActive || (register.Info.PayWhenActive && clerck.Household.IsActive)) { clerck.ModifyFunds(pay); } if (!register.Info.PayWhenActive || (register.Info.PayWhenActive && owner.Household.IsActive)) { owner.ModifyFunds(-pay); } } }
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(); // } // } // } // } //} } }
public static StoreSetRegister ReturnRegister(ObjectGuid id, Lot lot) { StoreSetRegister register = null; List <StoreSetRegister> registers = new List <StoreSetRegister>(Sims3.Gameplay.Queries.GetObjects <StoreSetRegister>(lot)); if (registers != null && registers.Count > 0) { register = registers.Find(delegate(StoreSetRegister r) { return(r.ObjectId == id); }); } return(register); }
public static bool IsStoreOpen(StoreSetRegister register) { if (register == null) { return(false); } if (!register.Info.Open || !SimClock.IsTimeBetweenTimes(register.mOvenHoursStart, register.mOvenHoursEnd)) { return(false); } else { return(true); } }
public static GameObject ReturnRestocableObject(RestockItem rItem, ObjectGuid registerId) { StoreSetRegister register = null; GameObject restockObject = null; //If item is linked to a register, restock from the correct inventory if (registerId != ObjectGuid.InvalidObjectGuid) { register = CMStoreSet.ReturnRegister(registerId, rItem.LotCurrent); restockObject = ReturnRestocableObjectFromRegister(rItem, registerId); } if (restockObject != null && register != null && !register.Inventory.TryToRemove(restockObject)) { restockObject = null; } return(restockObject); }
public static GameObject RecreateSoldObject(RestockItem restockItem, SimDescription actor) { try { IGameObject gameObject = null; bool restockBuyMode = false; bool restockCraftable = false; StoreSetRegister register = null; bool isRug; StoreSetBase shopBase = ReturnStoreSetBase(restockItem, out isRug); if (shopBase != null) { if (shopBase.Info.RegisterId != ObjectGuid.InvalidObjectGuid) { register = CMStoreSet.ReturnRegister(shopBase.Info.RegisterId, shopBase.LotCurrent); } restockBuyMode = shopBase.Info.RestockBuyMode; restockCraftable = shopBase.Info.RestockCraftable; #region Find the slot bool slotFound = false; Slot slot = Slot.ContainmentSlot_0; if (!isRug) { Slot[] containmentSlots = shopBase.GetContainmentSlots(); if (containmentSlots != null) { for (int i = 0; i < containmentSlots.Length; i++) { GameObject o = shopBase.GetContainedObject(containmentSlots[i]) as GameObject; if (o != null && o.ObjectId == restockItem.ObjectId) { slotFound = true; slot = containmentSlots[i]; break; } } } } #endregion //Restock from inventory only, if not buy object and linked to register bool restockFromInventory = RestockFromInventory(restockItem, restockCraftable); //Restock from buy mode #region Buy Mode if (!restockFromInventory) { if (restockItem.info.Type == ItemType.Buy || restockItem.info.Type == ItemType.Craftable) { gameObject = GlobalFunctions.CreateObject(restockItem.info.Key, restockItem.Position, restockItem.mLevel, restockItem.ForwardVector); if (!(gameObject is FailureObject)) { if (!string.IsNullOrEmpty(restockItem.info.DesignPreset)) { SortedList <string, bool> enabledStencils = new SortedList <string, bool>(); SortedList <string, Complate> patterns = StoreHelperClass.ExtractPatterns(restockItem.info.DesignPreset, enabledStencils); DesignModeSwap designModeSwap = Complate.SetupDesignSwap(gameObject.ObjectId, patterns, false, enabledStencils); if (designModeSwap != null) { designModeSwap.ApplyToObject(); } } } } else { gameObject = ReturnShoppingObject(restockItem, actor, register); gameObject.AddToWorld(); gameObject.SetPosition(restockItem.Position); } #region Pay for Restock //Reduce from base owner or register's owner if (shopBase.Info.Owner != 0uL) { SimDescription sd = CMStoreSet.ReturnSim(shopBase.Info.Owner); if (sd != null) { sd.ModifyFunds(-restockItem.info.Price); } else { CMStoreSet.PrintMessage("Couldn't find owner sim"); } } else if (shopBase.Info.RegisterId != ObjectGuid.InvalidObjectGuid) { //StoreSetRegister register = CMStoreSet.ReturnRegister(shopBase.Info.RegisterId, shopBase.LotCurrent); if (register != null && register.Info.OwnerId != 0uL) { SimDescription sd = CMStoreSet.ReturnSim(register.Info.OwnerId); if (sd != null) { sd.ModifyFunds(-restockItem.info.Price); } } } #endregion } #endregion Buy Mode #region Inventory else { //Restock from Inventory if (shopBase != null && shopBase.Info.RegisterId != ObjectGuid.InvalidObjectGuid) { gameObject = ReturnRestocableObject(restockItem, shopBase.Info.RegisterId); if (gameObject != null) { gameObject.AddToWorld(); gameObject.SetPosition(restockItem.Position); gameObject.SetForward(restockItem.ForwardVector); } else { CMStoreSet.PrintMessage("Restockable object null"); } } } #endregion Inventory //Delete restock object if (restockItem != null) { restockItem.Destroy(); } //Add restocked item back to slot if (slotFound) { IGameObject io = (IGameObject)shopBase; gameObject.ParentToSlot(io, slot); } return((GameObject)gameObject); } else { return(null); } } catch (System.Exception ex) { CMStoreSet.PrintMessage("RecreateSoldObject: " + ex.Message); return(null); } }
public static GameObject ReturnShoppingObject(RestockItem rItem, SimDescription actor, StoreSetRegister register) { GameObject o = null; bool keepLooping = true; switch (rItem.info.Type) { case ItemType.Herb: case ItemType.Ingredient: foreach (KeyValuePair <string, List <StoreItem> > kvp in Grocery.mItemDictionary) { foreach (StoreItem item in kvp.Value) { if (item.Name.Equals(rItem.info.Name)) { keepLooping = false; IngredientData data = (IngredientData)item.CustomData; if (rItem.info.Type == ItemType.Ingredient) { o = Ingredient.Create(data); } else { o = Herb.Create(data); //PlantableNonIngredientData data = (PlantableNonIngredientData)item.CustomData; //o = (GameObject)PlantableNonIngredient.Create(data); } break; } } if (!keepLooping) { break; } } break; case ItemType.Fish: o = Fish.CreateFishOfRandomWeight(rItem.info.FType); break; case ItemType.Craftable: break; case ItemType.Gem: case ItemType.Metal: o = (GameObject)RockGemMetalBase.Make(rItem.info.RockData, false); break; case ItemType.Nectar: NectarBottle bottle = (NectarBottle)GlobalFunctions.CreateObjectOutOfWorld("NectarBottle"); NectarBottleObjectInitParams nectarBottleObjectInitParams = bottle.CreateAncientBottle(rItem.info.NectarAge, rItem.info.Price); if (nectarBottleObjectInitParams != null) { bottle.mBottleInfo.FruitHash = nectarBottleObjectInitParams.FruitHash; bottle.mBottleInfo.Ingredients = nectarBottleObjectInitParams.Ingredients; bottle.mBottleInfo.Name = rItem.info.Name; //nectarBottleObjectInitParams.Name; bottle.mDateString = nectarBottleObjectInitParams.DateString; bottle.mBottleInfo.DateNum = nectarBottleObjectInitParams.DateNum; bottle.mBaseValue = rItem.info.Price; // nectarBottleObjectInitParams.BaseValue; bottle.ValueModifier = (int)(nectarBottleObjectInitParams.CurrentValue - rItem.info.Price); bottle.mBottleInfo.mCreator = nectarBottleObjectInitParams.Creator; bottle.mBottleInfo.NectarQuality = Sims3.Gameplay.Objects.Quality.Neutral; //NectarBottle.GetQuality((float)rItem.info.Price); bottle.mBottleInfo.MadeByLevel10Sim = nectarBottleObjectInitParams.MadeByLevel10Sim; bottle.UpdateVisualState(); } o = bottle; break; case ItemType.AlchemyPotion: foreach (AlchemyRecipe recipe in AlchemyRecipe.GetAllAwardPotionRecipes()) { if (rItem.info.Name.Equals(recipe.Name)) { string[] array = new string[] { recipe.Key }; AlchemyRecipe randomAwardPotionRecipe = AlchemyRecipe.GetRandomAwardPotionRecipe(); PotionShopConsignmentRegister.PotionShopConsignmentRegisterData potionShopConsignmentRegisterData = new PotionShopConsignmentRegister.PotionShopConsignmentRegisterData(); potionShopConsignmentRegisterData.mParameters = array; potionShopConsignmentRegisterData.mObjectName = randomAwardPotionRecipe.MedatorName; potionShopConsignmentRegisterData.mGuid = potionShopConsignmentRegisterData.mObjectName.GetHashCode(); potionShopConsignmentRegisterData.mSellerAge = CASAgeGenderFlags.None; potionShopConsignmentRegisterData.mWeight = 100f; potionShopConsignmentRegisterData.mSellPriceMinimum = 0.75f; potionShopConsignmentRegisterData.mSellPriceMaximum = 1.25f; potionShopConsignmentRegisterData.mDepreciationAgeMinimum = 0; potionShopConsignmentRegisterData.mDepreciationAgeMaximum = 5; potionShopConsignmentRegisterData.mLifespan = 3f; string text = string.Empty; if (!string.IsNullOrEmpty(randomAwardPotionRecipe.CustomClassName)) { text = randomAwardPotionRecipe.CustomClassName; } else { text = "Sims3.Gameplay.Objects.Alchemy.AlchemyPotion"; } potionShopConsignmentRegisterData.mScriptClass = text; potionShopConsignmentRegisterData.mIsRotatable = true; PotionShopConsignmentRegister.PotionShopConsignmentRegisterObjectData potionShopConsignmentRegisterObjectData2 = PotionShopConsignmentRegister.PotionShopConsignmentRegisterObjectData.Create(potionShopConsignmentRegisterData); potionShopConsignmentRegisterObjectData2.ShowTooltip = true; o = (GameObject)potionShopConsignmentRegisterObjectData2.mObject; break; } } break; case ItemType.Bug: Terrarium t = Terrarium.Create(rItem.info.BugType); if (t != null) { t.StartVfx(); } o = t; break; case ItemType.Food: int servingPrice = 25; if (register != null) { servingPrice = register.Info.ServingPrice; } IFoodContainer container = rItem.info.cookingProcess.Recipe.CreateFinishedFood(rItem.info.cookingProcess.Quantity, rItem.info.cookingProcess.Quality); if (rItem.info.cookingProcess.Quantity == Recipe.MealQuantity.Group) { ((ServingContainerGroup)container).mPurchasedPrice = StoreHelperClass.ReturnPriceByQuality(rItem.info.cookingProcess.Quality, servingPrice * ((ServingContainerGroup)container).mNumServingsLeft); ((ServingContainerGroup)container).RemoveSpoilageAlarm(); } else { ((ServingContainerSingle)container).mPurchasedPrice = StoreHelperClass.ReturnPriceByQuality(rItem.info.cookingProcess.Quality, servingPrice); ((ServingContainerSingle)container).RemoveSpoilageAlarm(); } o = (GameObject)container; break; case ItemType.Flowers: o = Wildflower.CreateWildflowerOfType(rItem.info.TypeOfWildFlower, Wildflower.WildflowerState.InVase); break; case ItemType.BookAlchemyRecipe_: case ItemType.BookComic_: case ItemType.BookFish_: case ItemType.BookGeneral_: case ItemType.BookRecipe_: case ItemType.BookSkill_: case ItemType.BookToddler_: case ItemType.SheetMusic_: case ItemType.AcademicTextBook_: foreach (KeyValuePair <string, List <StoreItem> > kvp in Bookstore.sItemDictionary) { foreach (StoreItem item in kvp.Value) { if (item.Name.Equals(rItem.info.Name)) { keepLooping = false; if (rItem.info.Type == ItemType.BookGeneral_) { o = (GameObject)BookGeneral.CreateOutOfWorld(item.CustomData as BookGeneralData); } if (rItem.info.Type == ItemType.BookSkill_) { o = (GameObject)BookSkill.CreateOutOfWorld(item.CustomData as BookSkillData); } if (rItem.info.Type == ItemType.BookRecipe_) { o = (GameObject)BookRecipe.CreateOutOfWorld(item.CustomData as BookRecipeData); } if (rItem.info.Type == ItemType.SheetMusic_) { o = (GameObject)SheetMusic.CreateOutOfWorld(item.CustomData as SheetMusicData); } if (rItem.info.Type == ItemType.BookToddler_) { o = (GameObject)BookToddler.CreateOutOfWorld(item.CustomData as BookToddlerData); } if (rItem.info.Type == ItemType.BookFish_) { o = (GameObject)BookFish.CreateOutOfWorld(item.CustomData as BookFishData); } if (rItem.info.Type == ItemType.BookAlchemyRecipe_) { o = (GameObject)BookAlchemyRecipe.CreateOutOfWorld(item.CustomData as BookAlchemyRecipeData); } if (rItem.info.Type == ItemType.AcademicTextBook_) { o = (GameObject)AcademicTextBook.CreateOutOfWorld(item.CustomData as AcademicTextBookData, actor); } if (rItem.info.Type == ItemType.BookComic_) { o = (GameObject)BookComic.CreateOutOfWorld(item.CustomData as BookComicData); } break; } } if (!keepLooping) { break; } } break; case ItemType.JamJar: JamJar jamJar = GlobalFunctions.CreateObjectOutOfWorld("canningJarJam", ProductVersion.Store) as JamJar; if (jamJar != null) { Type tInfo = jamJar.GetType(); BindingFlags flags = BindingFlags.Instance | BindingFlags.NonPublic; FieldInfo ingredientDataField = tInfo.GetField("mData", flags); FieldInfo ingredientKeyField = tInfo.GetField("mIngredientKey", flags); FieldInfo qualityField = tInfo.GetField("mQuality", flags); FieldInfo preservesField = tInfo.GetField("mIsPreserves", flags); MethodInfo materialStateMethod = tInfo.GetMethod("SetMaterialState", flags); ingredientDataField.SetValue(jamJar, rItem.info.IngData); ingredientKeyField.SetValue(jamJar, rItem.info.IngredientKey); qualityField.SetValue(jamJar, rItem.info.JamQuality); preservesField.SetValue(jamJar, rItem.info.JamIsPreserve); materialStateMethod.Invoke(jamJar, null); } o = (GameObject)jamJar; break; default: break; } return(o); }
public static bool AddPurchaseInteraction(Sim sim, GameObject o, StoreSetBase sBase, bool isAutonomous) { if (o.GetType() == typeof(FoodProp)) { return(false); } if (o.GetType() == typeof(RestockItem)) { return(false); } if (o.Charred) { return(false); } //Custom tests //Find register and then the owner if (sim != null && sBase != null) { StoreSetRegister register = null; if (sBase.Info.RegisterId != ObjectGuid.InvalidObjectGuid) { register = CMStoreSet.ReturnRegister(sBase.Info.RegisterId, sBase.LotCurrent); } //If linked to register and nobody tending, can't buy //TODO //If sim is not in the active household and BuyWhenActive = true //Can buy autonomously only if store owner is the active hosuehold if (isAutonomous && StoreSetBase.ReturnBuyWhenActive()) { SimDescription owner = null; if (sBase.Info.Owner != 0uL) { owner = CMStoreSet.ReturnSim(sBase.Info.Owner); } else if (sBase.Info.RegisterId != ObjectGuid.InvalidObjectGuid) { if (register != null && register.Info.OwnerId != 0uL) { owner = CMStoreSet.ReturnSim(register.Info.OwnerId); } } //in-active sims shouldn't buy unless from the store of the active sim if ((!sim.Household.IsActive && owner == null) || (!sim.Household.IsActive && owner != null && !owner.Household.IsActive)) { return(false); } //Sims in the active household can buy if they don't own the store if (sim.Household.IsActive && owner != null && owner.Household.IsActive) { return(false); } } } return(true); }
public static bool IsStoreOpen(StoreSetRegister register) { if (register == null) return false; if (!register.Info.Open || !SimClock.IsTimeBetweenTimes(register.mOvenHoursStart, register.mOvenHoursEnd)) return false; else return true; }
public static void PayWages(Sim clerck, StoreSetRegister register, float startTime, float endTime) { int pay = register.Info.HourlyWage * ((int)(endTime - startTime)); // CMStoreSet.PrintMessage(this.Actor.FullName + " pay : " + pay); SimDescription owner = null; if (register.Info.OwnerId != 0uL) CMStoreSet.ReturnSim(register.Info.OwnerId); if (owner == null) { if (!register.Info.PayWhenActive || (register.Info.PayWhenActive && clerck.Household.IsActive)) clerck.ModifyFunds(pay); } else if (owner != null && clerck.Household.HouseholdId != owner.Household.HouseholdId) { if (!register.Info.PayWhenActive || (register.Info.PayWhenActive && clerck.Household.IsActive)) clerck.ModifyFunds(pay); if (!register.Info.PayWhenActive || (register.Info.PayWhenActive && owner.Household.IsActive)) owner.ModifyFunds(-pay); } }
public static StoreSetRegister ReturnRegisterForLinking(StoreSetRegister[] objects) { ThumbnailKey thumbnail = ThumbnailKey.kInvalidThumbnailKey; string text = string.Empty; List<ObjectPicker.RowInfo> list = new List<ObjectPicker.RowInfo>(); foreach (StoreSetRegister t in objects) { List<ObjectPicker.ColumnInfo> list2 = new List<ObjectPicker.ColumnInfo>(); int num = 0; thumbnail = t.GetThumbnailKey(); text = t.Info.RegisterName; //common list2.Add(new ObjectPicker.ThumbAndTextColumn(thumbnail, text)); list2.Add(new ObjectPicker.MoneyColumn(num)); ObjectPicker.RowInfo item = new ObjectPicker.RowInfo(t, list2); list.Add(item); } List<ObjectPicker.HeaderInfo> list3 = new List<ObjectPicker.HeaderInfo>(); List<ObjectPicker.TabInfo> list4 = new List<ObjectPicker.TabInfo>(); list3.Add(new ObjectPicker.HeaderInfo(string.Empty, string.Empty, 200)); list3.Add(new ObjectPicker.HeaderInfo("1", "2")); list4.Add(new ObjectPicker.TabInfo("3", CMStoreSet.LocalizeString("LinkToRegister", new object[0]), list)); List<ObjectPicker.RowInfo> list5 = TaxCollectorSimpleDialog.Show(CMStoreSet.LocalizeString("LikToRegister", new object[0] { }), 0, list4, list3, true); if (list5 == null || list5.Count != 1) { return null; } return (list5[0].Item as StoreSetRegister); }
public static GameObject ReturnShoppingObject(RestockItem rItem, SimDescription actor, StoreSetRegister register) { GameObject o = null; bool keepLooping = true; switch (rItem.info.Type) { case ItemType.Herb: case ItemType.Ingredient: foreach (KeyValuePair<string, List<StoreItem>> kvp in Grocery.mItemDictionary) { foreach (StoreItem item in kvp.Value) { if (item.Name.Equals(rItem.info.Name)) { keepLooping = false; IngredientData data = (IngredientData)item.CustomData; if (rItem.info.Type == ItemType.Ingredient) { o = Ingredient.Create(data); } else { o = Herb.Create(data); //PlantableNonIngredientData data = (PlantableNonIngredientData)item.CustomData; //o = (GameObject)PlantableNonIngredient.Create(data); } break; } } if (!keepLooping) break; } break; case ItemType.Fish: o = Fish.CreateFishOfRandomWeight(rItem.info.FType); break; case ItemType.Craftable: break; case ItemType.Gem: case ItemType.Metal: o = (GameObject)RockGemMetalBase.Make(rItem.info.RockData, false); break; case ItemType.Nectar: NectarBottle bottle = (NectarBottle)GlobalFunctions.CreateObjectOutOfWorld("NectarBottle"); NectarBottleObjectInitParams nectarBottleObjectInitParams = bottle.CreateAncientBottle(rItem.info.NectarAge, rItem.info.Price); if (nectarBottleObjectInitParams != null) { bottle.mBottleInfo.FruitHash = nectarBottleObjectInitParams.FruitHash; bottle.mBottleInfo.Ingredients = nectarBottleObjectInitParams.Ingredients; bottle.mBottleInfo.Name = rItem.info.Name;//nectarBottleObjectInitParams.Name; bottle.mDateString = nectarBottleObjectInitParams.DateString; bottle.mBottleInfo.DateNum = nectarBottleObjectInitParams.DateNum; bottle.mBaseValue = rItem.info.Price;// nectarBottleObjectInitParams.BaseValue; bottle.ValueModifier = (int)(nectarBottleObjectInitParams.CurrentValue - rItem.info.Price); bottle.mBottleInfo.mCreator = nectarBottleObjectInitParams.Creator; bottle.mBottleInfo.NectarQuality = Sims3.Gameplay.Objects.Quality.Neutral;//NectarBottle.GetQuality((float)rItem.info.Price); bottle.mBottleInfo.MadeByLevel10Sim = nectarBottleObjectInitParams.MadeByLevel10Sim; bottle.UpdateVisualState(); } o = bottle; break; case ItemType.AlchemyPotion: foreach (AlchemyRecipe recipe in AlchemyRecipe.GetAllAwardPotionRecipes()) { if (rItem.info.Name.Equals(recipe.Name)) { string[] array = new string[] { recipe.Key }; AlchemyRecipe randomAwardPotionRecipe = AlchemyRecipe.GetRandomAwardPotionRecipe(); PotionShopConsignmentRegister.PotionShopConsignmentRegisterData potionShopConsignmentRegisterData = new PotionShopConsignmentRegister.PotionShopConsignmentRegisterData(); potionShopConsignmentRegisterData.mParameters = array; potionShopConsignmentRegisterData.mObjectName = randomAwardPotionRecipe.MedatorName; potionShopConsignmentRegisterData.mGuid = potionShopConsignmentRegisterData.mObjectName.GetHashCode(); potionShopConsignmentRegisterData.mSellerAge = CASAgeGenderFlags.None; potionShopConsignmentRegisterData.mWeight = 100f; potionShopConsignmentRegisterData.mSellPriceMinimum = 0.75f; potionShopConsignmentRegisterData.mSellPriceMaximum = 1.25f; potionShopConsignmentRegisterData.mDepreciationAgeMinimum = 0; potionShopConsignmentRegisterData.mDepreciationAgeMaximum = 5; potionShopConsignmentRegisterData.mLifespan = 3f; string text = string.Empty; if (!string.IsNullOrEmpty(randomAwardPotionRecipe.CustomClassName)) { text = randomAwardPotionRecipe.CustomClassName; } else { text = "Sims3.Gameplay.Objects.Alchemy.AlchemyPotion"; } potionShopConsignmentRegisterData.mScriptClass = text; potionShopConsignmentRegisterData.mIsRotatable = true; PotionShopConsignmentRegister.PotionShopConsignmentRegisterObjectData potionShopConsignmentRegisterObjectData2 = PotionShopConsignmentRegister.PotionShopConsignmentRegisterObjectData.Create(potionShopConsignmentRegisterData); potionShopConsignmentRegisterObjectData2.ShowTooltip = true; o = (GameObject)potionShopConsignmentRegisterObjectData2.mObject; break; } } break; case ItemType.Bug: Terrarium t = Terrarium.Create(rItem.info.BugType); if (t != null) t.StartVfx(); o = t; break; case ItemType.Food: int servingPrice = 25; if (register != null) servingPrice = register.Info.ServingPrice; IFoodContainer container = rItem.info.cookingProcess.Recipe.CreateFinishedFood(rItem.info.cookingProcess.Quantity, rItem.info.cookingProcess.Quality); if (rItem.info.cookingProcess.Quantity == Recipe.MealQuantity.Group) { ((ServingContainerGroup)container).mPurchasedPrice = StoreHelperClass.ReturnPriceByQuality(rItem.info.cookingProcess.Quality, servingPrice * ((ServingContainerGroup)container).mNumServingsLeft); ((ServingContainerGroup)container).RemoveSpoilageAlarm(); } else { ((ServingContainerSingle)container).mPurchasedPrice = StoreHelperClass.ReturnPriceByQuality(rItem.info.cookingProcess.Quality, servingPrice); ((ServingContainerSingle)container).RemoveSpoilageAlarm(); } o = (GameObject)container; break; case ItemType.Flowers: o = Wildflower.CreateWildflowerOfType(rItem.info.TypeOfWildFlower, Wildflower.WildflowerState.InVase); break; case ItemType.BookAlchemyRecipe_: case ItemType.BookComic_: case ItemType.BookFish_: case ItemType.BookGeneral_: case ItemType.BookRecipe_: case ItemType.BookSkill_: case ItemType.BookToddler_: case ItemType.SheetMusic_: case ItemType.AcademicTextBook_: foreach (KeyValuePair<string, List<StoreItem>> kvp in Bookstore.sItemDictionary) { foreach (StoreItem item in kvp.Value) { if (item.Name.Equals(rItem.info.Name)) { keepLooping = false; if (rItem.info.Type == ItemType.BookGeneral_) o = (GameObject)BookGeneral.CreateOutOfWorld(item.CustomData as BookGeneralData); if (rItem.info.Type == ItemType.BookSkill_) o = (GameObject)BookSkill.CreateOutOfWorld(item.CustomData as BookSkillData); if (rItem.info.Type == ItemType.BookRecipe_) o = (GameObject)BookRecipe.CreateOutOfWorld(item.CustomData as BookRecipeData); if (rItem.info.Type == ItemType.SheetMusic_) o = (GameObject)SheetMusic.CreateOutOfWorld(item.CustomData as SheetMusicData); if (rItem.info.Type == ItemType.BookToddler_) o = (GameObject)BookToddler.CreateOutOfWorld(item.CustomData as BookToddlerData); if (rItem.info.Type == ItemType.BookFish_) o = (GameObject)BookFish.CreateOutOfWorld(item.CustomData as BookFishData); if (rItem.info.Type == ItemType.BookAlchemyRecipe_) o = (GameObject)BookAlchemyRecipe.CreateOutOfWorld(item.CustomData as BookAlchemyRecipeData); if (rItem.info.Type == ItemType.AcademicTextBook_) o = (GameObject)AcademicTextBook.CreateOutOfWorld(item.CustomData as AcademicTextBookData, actor); if (rItem.info.Type == ItemType.BookComic_) o = (GameObject)BookComic.CreateOutOfWorld(item.CustomData as BookComicData); break; } } if (!keepLooping) break; } break; case ItemType.JamJar: JamJar jamJar = GlobalFunctions.CreateObjectOutOfWorld ("canningJarJam", ProductVersion.Store) as JamJar; if (jamJar != null) { Type tInfo = jamJar.GetType (); BindingFlags flags = BindingFlags.Instance | BindingFlags.NonPublic; FieldInfo ingredientDataField = tInfo.GetField ("mData", flags); FieldInfo ingredientKeyField = tInfo.GetField ("mIngredientKey", flags); FieldInfo qualityField = tInfo.GetField ("mQuality", flags); FieldInfo preservesField = tInfo.GetField ("mIsPreserves", flags); ingredientDataField.SetValue (jamJar, rItem.info.IngData); ingredientKeyField.SetValue (jamJar, rItem.info.IngredientKey); qualityField.SetValue (jamJar, rItem.info.JamQuality); preservesField.SetValue (jamJar, rItem.info.JamIsPreserve); } o = (GameObject)jamJar; break; default: break; } return o; }