/// <summary> /// Loads all the Model Names for Specific Category and SubcategoryID. /// </summary> /// <param name="intCategoryID"></param> /// <param name="intSubcategoryID"></param> private void LoadList_SecondSubcategory(int intSubcategoryID) { try { RealEstate objRealEstate = new RealEstate(); RealEstateManager manager = new RealEstateManager(); objRealEstate.SubcategoryID = intSubcategoryID; DataTable dt = manager.Load_LeftMenu_SecondSubcategory(objRealEstate); if (dt.Rows.Count > 0) { repList.DataSource = dt; repList.DataBind(); } else { repList.DataSource = null; repList.DataBind(); this.Visible = false; } } catch (Exception ex) { Response.Write(ex.Message); } }
private void LoadList_RealEstate_BS_SellerProduct(int _CategoryID, int _SubcategoryID, int _ProfileID, string _Country) { RealEstate objRealEstate = new RealEstate(); RealEstateManager objrealEstatemanager = new RealEstateManager(); objRealEstate.CategoryID = _CategoryID; objRealEstate.SubcategoryID = _SubcategoryID; objRealEstate.ProfileID = _ProfileID; objRealEstate.Country = _Country; try { using (BC_CorporateSeller bs_Seller = new BC_CorporateSeller()) { DataTable dt = bs_Seller.LoadSpecific_BS_SellerProduct(_CategoryID, _SubcategoryID, _ProfileID, _Country); if (dt.Rows.Count > 0) { InitializeGridView(dt, grvRealEstate); } else { InitializeGridView(null, grvRealEstate); } } } catch (Exception ex) { lblSystemMessage.Text = ex.Message; } }
public static void ReimburseDeeds(RealEstateManager newOwner, RabbitHole rabbitHole) { foreach (Household house in Household.GetHouseholdsLivingInWorld()) { if (house.RealEstateManager == null) { continue; } if (house.RealEstateManager == newOwner) { continue; } PropertyData data = house.RealEstateManager.FindProperty(rabbitHole); if (data == null) { continue; } int totaValue = data.TotalValue; using (ManagerMoney.SetAccountingKey setKey = new ManagerMoney.SetAccountingKey(house, "PropertySold")) { house.RealEstateManager.SellProperty(data, true); } if (house != Household.ActiveHousehold) { Common.Notify(Common.Localize("Deeds:Reimbursement", false, new object[] { house.Name, totaValue })); } } }
public static IPropertyData PurchaceorUpgradeRabbitHole(RealEstateManager ths, RabbitHole rabbitHole) { IPropertyData data = null; PropertyData data2 = ths.FindProperty(rabbitHole); if (data2 == null) { if (ths.mOwningHousehold.FamilyFunds >= rabbitHole.RabbitHoleTuning.kInvestCost) { NRaas.StoryProgression.Main.Money.AdjustFunds(ths.mOwningHousehold, "PropertyBought", -rabbitHole.RabbitHoleTuning.kInvestCost); data2 = new PropertyData.RabbitHole(rabbitHole, ths); ths.AddToProperties(data2); } } else if (ths.mOwningHousehold.FamilyFunds >= rabbitHole.RabbitHoleTuning.kBuyoutCost) { ReimburseDeeds(ths, rabbitHole); NRaas.StoryProgression.Main.Money.AdjustFunds(ths.mOwningHousehold, "PropertyBought", -rabbitHole.RabbitHoleTuning.kBuyoutCost); data2.UpgradeToFullOwnership(); ths.UpdateProperty(data2); } data = data2; if (data != null) { Tutorialette.TriggerLesson(Lessons.RealEstate, null); } return(data); }
private void LoadList_PostedRealEstate(int _ProfileID, DateTime startDate, DateTime endDate) { RealEstate objRealEstate = new RealEstate(); RealEstateManager manager = new RealEstateManager(); objRealEstate.ProfileID = _ProfileID; objRealEstate.StartDate = startDate; objRealEstate.EndDate = endDate; try { DataTable dt = manager.LoadList_PostedRealEstate(objRealEstate); if (dt.Rows.Count > 0) { grvRealEstate.DataSource = dt; grvRealEstate.DataBind(); } else { grvRealEstate.DataSource = null; grvRealEstate.DataBind(); } } catch (Exception ex) { lblSystemMessage.Text = ex.Message; } }
/// <summary> /// Loads List of Real Estate of Classified Seller by Subcategory. /// </summary> /// <param name="_CategoryID"></param> /// <param name="_SubcategoryID"></param> private void LoadList_RealEstate_CL_SellerProduct(int _CategoryID, int _SubcategoryID) { RealEstate objRealEstate = new RealEstate(); RealEstateManager objrealEstatemanager = new RealEstateManager(); objRealEstate.CategoryID = _CategoryID; objRealEstate.SubcategoryID = _SubcategoryID; try { DataTable dt = objrealEstatemanager.Load_RealEstate_CLProductList_BySubcategory(objRealEstate); if (dt.Rows.Count > 0) { InitializeGridView(dt, grvRealEstate); } else { InitializeGridView(null, grvRealEstate); } } catch (Exception ex) { lblSystemMessage.Text = ex.Message; } }
private List <RealEstateItem> GetRealEstateItems() { RealEstateManager mng = new RealEstateManager(); List <RealEstateItem> items = mng.GetItems() .Where(item => item.Status == Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live) .OrderByDescending(item => item.DateCreated) .Take(this.NumberOfItemsToShow).ToList(); return(items); }
public static List <Lot> GetPurchaseableLots() { if (Common.IsAwayFromHomeworld()) { return(RealEstateManager.GetPurchaseableLots()); } else { return(GetPurchaseableLots(StoryProgression.Main.Money, Household.ActiveHousehold)); } }
public PropertyData FindVenueProperty(RealEstateManager ths, Lot l) { Predicate <PropertyData> match = delegate(PropertyData d) { if ((d.PropertyType != RealEstatePropertyType.Venue) && (d.PropertyType != RealEstatePropertyType.Resort)) { return(false); } return(d.LotId == l.LotId); }; return(ths.mAllProperties.Find(match)); }
public static bool PurchaseLocationHomeInteractionTest(Sim actor, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if (!CanPurchaseLocationHome(actor, ref greyedOutTooltipCallback)) { return(false); } if (RealEstateManager.GetPurchaseableLots().Count == 0x0) { greyedOutTooltipCallback = Common.DebugTooltip("No Purchaseable Lots"); return(false); } return(true); }
private void LoadDetailRealEstate(int _ProductID) { RealEstate objRealEstate = new RealEstate(); RealEstateManager objrealEstatemanager = new RealEstateManager(); objRealEstate.ProductID = _ProductID; DataTable dt = objrealEstatemanager.LoadRecord_Detail_RealEstate(objRealEstate); if (dt.Rows.Count > 0) { fvRealEstateDetail.DataSource = dt; fvRealEstateDetail.DataBind(); } }
public static List <Lot> GetPurchaseableLots(StoryProgressionObject manager, Household buyer) { Dictionary <ulong, bool> owned = new Dictionary <ulong, bool>(); foreach (PropertyData data in RealEstateManager.AllPropertiesFromAllHouseholds()) { owned[data.LotId] = true; } List <Lot> list = new List <Lot>(); foreach (Lot lot in LotManager.AllLots) { if (lot.IsWorldLot) { continue; } if (lot.Household == buyer) { continue; } if (lot.LotType != LotType.Residential) { continue; } if (!IsRentable(manager, lot)) { continue; } if (owned.ContainsKey(lot.LotId)) { continue; } if (buyer.FamilyFunds < GetPurchaseLotCost(lot)) { continue; } list.Add(lot); } return(list); }
public bool HandleCost(Sim sim) { if (sim != null && sim.SimDescription.ChildOrAbove && mDoorCost > 0) { if (GoHere.Settings.mGlobalIgnoreDoorCostFilterOption.Count > 0) { if (FilterHelper.DoesSimMatchFilters(sim.SimDescription.SimDescriptionId, GoHere.Settings.mGlobalIgnoreDoorCostFilterOption, false)) { return(false); } } Household owningHousehold = sim.LotCurrent.Household; if (owningHousehold == null) { List <PropertyData> list = RealEstateManager.AllPropertiesFromAllHouseholds(); for (int k = 0; k < list.Count; k++) { if (((list[k] != null) && (sim.LotCurrent.LotId == list[k].LotId)) && ((list[k].Owner != null) && (list[k].Owner.OwningHousehold != null))) { owningHousehold = list[k].Owner.OwningHousehold; break; } } } if (sim.Household == null || (sim.Household != null && owningHousehold != sim.Household)) { if (sim.FamilyFunds > mDoorCost) { sim.ModifyFunds(-mDoorCost); } else { sim.UnpaidBills += mDoorCost; } if (owningHousehold != null) { owningHousehold.ModifyFamilyFunds(mDoorCost); } return(true); } } return(false); }
public override Phone.Call.ConversationBehavior OnCallConnected() { try { List <Lot> purchaseableLots = RentalHelper.GetPurchaseableLots(); if (purchaseableLots.Count != 0x0) { mChosenLot = RealEstateManager.ChooseLot(purchaseableLots, Actor, Localization.LocalizeString("Gameplay/Locations/LocationHomeDeed:PurchaseLot", new object[0x0]), true); } } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); } return(Phone.Call.ConversationBehavior.JustHangUp); }
public static void ReimburseDeeds(RealEstateManager newOwner, Lot lot) { foreach (Household house in Household.GetHouseholdsLivingInWorld()) { if (house.RealEstateManager == null) continue; if (house.RealEstateManager == newOwner) continue; PropertyData data = house.RealEstateManager.FindProperty(lot); if (data == null) continue; int totaValue = data.TotalValue; using (ManagerMoney.SetAccountingKey setKey = new ManagerMoney.SetAccountingKey(house, "PropertySold")) { house.RealEstateManager.SellProperty(data, true); } if (house != Household.ActiveHousehold) { Common.Notify(Common.Localize("Deeds:Reimbursement", false, new object[] { house.Name, totaValue })); } } }
/// <summary> /// Loads Specific Real Estate Product Record. /// </summary> private void SelectRecord_ProductProfile(int _ProductID) { try { RealEstate objRealEstate = new RealEstate(); objRealEstate.ProductID = _ProductID; RealEstateManager manager = new RealEstateManager(); objRealEstate = manager.SelectRecord_RealEstate(objRealEstate); //objRealEstate = new RealEstate(); if (objRealEstate.ProductID > 0) { lblSku.Text = objRealEstate.SKU; if (objRealEstate.IsInsideDhaka) { this.LoadList_DhakaArea(); ddlLocation.SelectedValue = objRealEstate.AreaID.ToString(); rblLocation.SelectedValue = "InDhaka"; EnablePanel(pnlArea, false); } else { this.LoadRecord_Province(); ddlLocation.SelectedValue = objRealEstate.ProvinceID.ToString(); rblLocation.SelectedValue = "OutDhaka"; txtArea.Text = Server.HtmlDecode(objRealEstate.Area); EnablePanel(pnlArea, true); } txtAddress.Text = Server.HtmlDecode(objRealEstate.Address); ddlSubcategory.SelectedValue = objRealEstate.SubcategoryID.ToString(); this.LoadRecord_SecondSubcategory(objRealEstate.CategoryID, objRealEstate.SubcategoryID); ddlSecondSubcategory.SelectedValue = objRealEstate.SecondSubcatID.ToString(); this.LoadList_SellerType(objRealEstate.SubcategoryID); ddlSellerType.SelectedValue = objRealEstate.SellerType.ToString(); txtSellerName.Text = Server.HtmlDecode(objRealEstate.SellerName); if (objRealEstate.SubcategoryID == 55)//IF FOR SALE { EnablePanel(pnlProjectType, false); } else { EnablePanel(pnlProjectType, true); this.LoadProjectType(objRealEstate.ProjectType); } txtSize.Text = objRealEstate.Size.ToString(); lblSizeUnit.Text = objRealEstate.SizeUnit; txtPrice.Text = objRealEstate.Price.ToString(); txtQuantity.Text = objRealEstate.Quantity.ToString(); ddlCurrency.SelectedValue = objRealEstate.Currency; if (objRealEstate.SecondSubcatID == 249 || objRealEstate.SecondSubcatID == 252 || objRealEstate.SecondSubcatID == 253 || objRealEstate.SecondSubcatID == 254) // Only for office & apartment { txtWashRooms.Text = objRealEstate.NoOfWashRoom; EnablePanel(pnlWashRooms, true); if (objRealEstate.SecondSubcatID == 249 || objRealEstate.SecondSubcatID == 252) // Only for apartment { txtBedRooms.Text = objRealEstate.NoOfBedRoom; EnablePanel(pnlBedRooms, true); } else { EnablePanel(pnlBedRooms, false); } } else { EnablePanel(pnlBedRooms, false); EnablePanel(pnlWashRooms, false); } if (objRealEstate.SecondSubcatID != 250 && objRealEstate.SecondSubcatID != 251) // Everything except land { txtServiceCharge.Text = objRealEstate.ServiceCharge.ToString(); EnablePanel(pnlServiceCharge, true); EnablePanel(pnlCarParking, true); EnablePanel(pnlLandNature, false); } else { EnablePanel(pnlServiceCharge, false); EnablePanel(pnlCarParking, false); EnablePanel(pnlLandNature, true); } chkIsCarParkingAvailable.Checked = objRealEstate.IsCarParkingAvailable; txtProjectName.Text = Server.HtmlDecode(objRealEstate.ProjectName); txtDescription.Text = Server.HtmlDecode(objRealEstate.Description); chkIsActive.Checked = objRealEstate.IsActive; ImagePath = objRealEstate.ProductImage; #region SOURCE SELECTION if (objRealEstate.Source == "ApnerDeal.com") { rblBoromela.Checked = true; rblNewspaper.Checked = false; } else { rblBoromela.Checked = false; rblNewspaper.Checked = true; txtNewspaper.Text = objRealEstate.Source; } chkIsDisplayAddress.Checked = objRealEstate.IsAlternativeAddress; #endregion SOURCE SELECTION } else { string strSystemMessage = ""; strSystemMessage = "<table style='width:500px; border:1px dashed #666666;'>"; strSystemMessage += "<tr>"; strSystemMessage += "<td align='center' style='width:10%;'><img src='../images/icon_error.gif' width='42' height='40' alt='' /></td>"; strSystemMessage += "<td valign='middle' style='width:90%;font-weight:bold; text-decoration:underline'>Following error occured :</td>"; strSystemMessage += "</tr>"; strSystemMessage += "<tr>"; strSystemMessage += "<td colspan='2' style='width:100%; color:#000000; padding-top:7px; padding-left:10px;'>"; strSystemMessage += "Product Profile not found!"; strSystemMessage += "<br/><br/>"; strSystemMessage += "<strong>How did this happen? </strong>"; strSystemMessage += "<ul>"; strSystemMessage += "<li>You login session may be expired.</li>"; strSystemMessage += "<li>Your Classified Ad may be deleted by ApnerDeal authority for some reason.</li>"; strSystemMessage += "</ul>"; strSystemMessage += "</td>"; strSystemMessage += "</tr>"; strSystemMessage += "</table>"; lblSystemMessage.Text = strSystemMessage; } } catch (Exception Exp) { lblSystemMessage.Text = Exp.Message.ToString(); } }
private int UpdateRecord_ProductProfile(int intProductID) { int intActionResult = 0; RealEstate objRealEstate = new RealEstate(); RealEstateManager manager = new RealEstateManager(); objRealEstate.ProfileID = _ProfileID; objRealEstate.UserType = _ClassifiedSeller; objRealEstate.ProductID = intProductID; //objRealEstate.SKU = lblSku.Text; //objRealEstate.CategoryID = _CategoryID; objRealEstate.SubcategoryID = Convert.ToInt32(ddlSubcategory.SelectedValue); objRealEstate.SecondSubcatID = Convert.ToInt32(ddlSecondSubcategory.SelectedValue); objRealEstate.SellerType = Convert.ToInt32(ddlSellerType.SelectedValue); objRealEstate.SellerName = Server.HtmlEncode(txtSellerName.Text); objRealEstate.ProjectType = ddlProjectType.SelectedItem.Text; objRealEstate.ProjectName = Server.HtmlEncode(txtProjectName.Text); if (rblLocation.SelectedValue == "OutDhaka") { objRealEstate.ProvinceID = Convert.ToInt32(ddlLocation.SelectedValue); objRealEstate.Area = Server.HtmlEncode(txtArea.Text); objRealEstate.IsInsideDhaka = false; objRealEstate.LocationID = objRealEstate.ProvinceID; objRealEstate.IsInsideDhaka = false; } else { objRealEstate.ProvinceID = _DhakaProvinceID; objRealEstate.AreaID = Convert.ToInt32(ddlLocation.SelectedValue); objRealEstate.IsInsideDhaka = true; objRealEstate.Area = ""; objRealEstate.LocationID = objRealEstate.AreaID; objRealEstate.IsInsideDhaka = true; } objRealEstate.Size = Convert.ToDouble(txtSize.Text); objRealEstate.SizeUnit = lblSizeUnit.Text; objRealEstate.LandNature = rblLandNature.SelectedValue; objRealEstate.Quantity = Convert.ToInt32(txtQuantity.Text); objRealEstate.Price = Convert.ToDouble(txtPrice.Text); objRealEstate.Currency = ddlCurrency.SelectedValue; if (ddlSecondSubcategory.SelectedValue == "249" || ddlSecondSubcategory.SelectedValue == "252" || ddlSecondSubcategory.SelectedValue == "253" || ddlSecondSubcategory.SelectedValue == "254") // Only for office & apartment { objRealEstate.NoOfWashRoom = Server.HtmlEncode(txtWashRooms.Text); if (ddlSecondSubcategory.SelectedValue == "249" || ddlSecondSubcategory.SelectedValue == "252") // Only for apartment { objRealEstate.NoOfBedRoom = Server.HtmlEncode(txtBedRooms.Text); } else { objRealEstate.NoOfBedRoom = ""; } } else { objRealEstate.NoOfWashRoom = ""; objRealEstate.NoOfBedRoom = ""; } if (ddlSecondSubcategory.SelectedValue != "250" && ddlSecondSubcategory.SelectedValue != "251") // Everything except land { objRealEstate.ServiceCharge = Convert.ToDouble(txtServiceCharge.Text); } else { objRealEstate.ServiceCharge = -1; } objRealEstate.IsCarParkingAvailable = chkIsCarParkingAvailable.Checked; objRealEstate.Description = Server.HtmlEncode(txtDescription.Text); objRealEstate.IsActive = chkIsActive.Checked; objRealEstate.Address = Server.HtmlEncode(txtAddress.Text); objRealEstate.UpdatedOn = DateTime.Now; objRealEstate.ProductImage = ImagePath == "Prdcts/Default/realestate.jpg" ? "Prdcts/Default/realestate.jpg" : ImagePath; objRealEstate.Source = rblBoromela.Checked ? "ApnerDeal.com" : txtNewspaper.Text; objRealEstate.IsAlternativeAddress = chkIsDisplayAddress.Checked; try { intActionResult = manager.UpdateRealEstate(objRealEstate); } catch (Exception ex) { lblSystemMessage.Text = ex.Message; } return(intActionResult); }
private new void OnSelection(UIBinInfo lotInfo) { if (lotInfo.HouseholdId == ulong.MaxValue) { if ((mInfo != null) && (mFrom != InfoSource.Unknown)) { LotValidity lotValidity = mModel.GetLotValidity(lotInfo.LotId); // EA Standard does not distinguish between vacation and private lots, messing up [StoryProgression] rental systems foreach (PropertyData data in RealEstateManager.AllPropertiesFromAllHouseholds()) { if (data.PropertyType == RealEstatePropertyType.VacationHome) { continue; } if (data.LotId == lotInfo.LotId) { Simulator.AddObject(new OneShotFunctionWithParams(WarnLotGeneric, lotInfo)); return; } } mModel.CenterCamera(lotInfo.LotId); if (mInfo.LotId != ulong.MaxValue) { bool allow = false; if (lotValidity == LotValidity.Valid) { allow = true; } else if ((Mover.Settings.mAllowGreaterThanEight) && (!mModel.LotContentsWillFit(mInfo, lotInfo.LotId))) { allow = true; } if (allow) { mPlacing = true; EditTownController.Instance.ShowUI(false); UIManager.DarkenBackground(true); Sims3.UI.Responder.Instance.DisableQuit(); Simulator.AddObject(new OneShotFunctionWithParams(PlaceLotTask, lotInfo)); } else if (!mModel.LotContentsWillFit(mInfo, lotInfo.LotId)) { Simulator.AddObject(new OneShotFunctionWithParams(WarnTooBig, lotInfo)); } else { Simulator.AddObject(new OneShotFunctionWithParams(WarnLotGeneric, lotInfo)); } } else if (mInfo.HouseholdId != ulong.MaxValue) { if (lotValidity == LotValidity.Unavailable) { if ((!Mover.Settings.mFreeRealEstate) && (mInfo.HouseholdFunds < lotInfo.LotWorth)) { Simulator.AddObject(new OneShotFunctionWithParams(WarnInsufficientFunds, lotInfo)); return; } } if (lotValidity != LotValidity.Invalid) { mPlacing = true; Simulator.AddObject(new OneShotFunctionWithParams(ConfirmPurchaseTaskEx, lotInfo)); return; } } } } else if (mInfo.LotId == ulong.MaxValue) { if (mFrom == InfoSource.Clipboard) { mModel.CenterCamera(lotInfo.LotId); GameEntryMovingModelEx.MergeHouseholds(EditTownController.Instance, mInfo, lotInfo); } else { mModel.CenterCamera(lotInfo.LotId); Simulator.AddObject(new OneShotFunctionWithParams(PlaceHouseholdTaskEx, lotInfo)); } } }
public static void RestockDisplay(CraftersConsignmentDisplay display, out Common.StringBuilder debug) { debug = new Common.StringBuilder("Display: " + display.CatalogName + Common.NewLine + "ObjectID:" + display.ObjectId); if (qualites.Count == 0) { InitLists(); } List <int> slotsToSkipForWeddingCakeSetupOnChiller = new List <int> { 23, 25 }; List <int> slotsToSkipForWeddingCakeSetupOnRack = new List <int> { 0, 2, 4 }; List <int> slotsForWeddingCakesChiller = new List <int> { 21, 22, 24 }; List <int> slotsForWeddingCakesOnRack = new List <int> { 1, 3 }; // wedding cake slots are included in these so they get stocked... if the cakes are disabled, they will be skipped properly List <int> slotsForElegantStockingOnRack = new List <int> { 1, 3, 5, 8, 9, 11, 13, 14, 17, 18, 20, 22, 23, 26 }; List <int> slotsForElegantStockingOnChiller = new List <int> { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 21, 22, 24 }; Recipe randomRestockRecipe = null; if (display.LotCurrent != null) { debug += Common.NewLine + "LotCurrent: " + display.LotCurrent.Name; } if (!display.InWorld) { debug += Common.NewLine + "Display not in world"; return; } if (Cupcake.Settings.IsDisplayExempt(display.ObjectId)) { debug += Common.NewLine + "Display has auto restock disabled"; return; } bool random = false; if (!Cupcake.Settings.HasSettings(display.ObjectId)) { debug += Common.NewLine + "Display has no user defined settings."; random = true; } if (!Cupcake.Settings.mAffectActive && random) { if (display.LotCurrent == null) { debug += Common.NewLine + "LotCurrent null"; return; } if (display.LotCurrent.LotId == Household.ActiveHousehold.LotId) { debug += Common.NewLine + "On active household lot"; return; } List <PropertyData> list = RealEstateManager.AllPropertiesFromAllHouseholds(); for (int i = 0; i < list.Count; i++) { if (list[i] != null && display.LotCurrent.LotId == list[i].LotId && list[i].Owner != null && list[i].Owner.OwningHousehold == Household.ActiveHousehold) { debug += Common.NewLine + "On owned lot"; return; } } } DisplayHelper.DisplayTypes displayType; Dictionary <int, Slot> slots = DisplayHelper.GetEmptyOrFoodSlots(display, out displayType); foreach (KeyValuePair <int, Slot> slot in slots) { debug += Common.NewLine + "Slot: " + slot.Key; if (displayType == DisplayHelper.DisplayTypes.Chiller) { if (!Cupcake.Settings.SlotHasSettings(display.ObjectId, slot.Key)) { if (slot.Key > 20 && !Cupcake.Settings.mStockWeddingCakes) { debug += Common.NewLine + "Wedding cakes disabled, skipping top shelf"; continue; } if (Cupcake.Settings.mStockWeddingCakes && slotsToSkipForWeddingCakeSetupOnChiller.Contains(slot.Key)) { debug += Common.NewLine + "Skipping slots for presentable wedding cake setup"; continue; } if (Cupcake.Settings.mElegantRestock && !slotsForElegantStockingOnChiller.Contains(slot.Key)) { debug += Common.NewLine + "Skipping slot for elegant restocking"; continue; } } } if (displayType == DisplayHelper.DisplayTypes.Rack) { if (!Cupcake.Settings.SlotHasSettings(display.ObjectId, slot.Key)) { if (Cupcake.Settings.mStockWeddingCakes && slotsToSkipForWeddingCakeSetupOnRack.Contains(slot.Key)) { debug += Common.NewLine + "Skipping slots for presentable wedding cake setup"; continue; } if (Cupcake.Settings.mElegantRestock && !slotsForElegantStockingOnRack.Contains(slot.Key)) { debug += Common.NewLine + "Skipping slot for elegant restocking"; continue; } } } GameObject containedObject = display.GetContainedObject(slot.Value) as GameObject; if (containedObject == null) { Dictionary <string, List <Quality> > settings = Cupcake.Settings.GetDisplaySettingsForSlot(display.ObjectId, slot.Key); Recipe recipe = null; IFoodContainer container = null; Quality quality = Quality.Perfect; if (random && !Cupcake.Settings.mDisableRandomAutoRestock && (!Cupcake.Settings.mOneRecipePerDisplayOnRandom || (Cupcake.Settings.mOneRecipePerDisplayOnRandom && randomRestockRecipe == null))) { debug += Common.NewLine + "Random"; if (Cupcake.Settings.mRandomRestockSettings.Count > 0) { if (Cupcake.Settings.Debugging) { debug += Common.NewLine + "Choices:"; foreach (KeyValuePair <string, List <Quality> > val in Cupcake.Settings.mRandomRestockSettings) { debug += Common.NewLine + val.Key; foreach (Quality val2 in val.Value) { debug += Common.NewLine + val2.ToString(); } } } if (Recipe.NameToRecipeHash.Count > 0) { string pick = RandomUtil.GetRandomObjectFromList <string>(new List <string>(Cupcake.Settings.mRandomRestockSettings.Keys)); if (Recipe.NameToRecipeHash.ContainsKey(pick)) { recipe = Recipe.NameToRecipeHash[pick]; debug += Common.NewLine + "Fetching random recipe..."; debug += Common.NewLine + "Pick: " + recipe.Key; quality = RandomUtil.GetRandomObjectFromList <Quality>(Cupcake.Settings.mRandomRestockSettings[pick]); debug += Common.NewLine + "Fetching random quality..."; debug += Common.NewLine + "Pick: " + quality.ToString(); } else { debug += Common.NewLine + "Failed to find defined recipe"; continue; } } } else { if (goodies.Count > 0) { recipe = RandomUtil.GetRandomObjectFromList <Recipe>(goodies); debug += Common.NewLine + "Fetching random bakery recipe..."; debug += Common.NewLine + "Pick: " + recipe.SpecificNameKey; debug += Common.NewLine + "Quality: Always Perfect"; } } randomRestockRecipe = recipe; } if (random && Cupcake.Settings.mOneRecipePerDisplayOnRandom && randomRestockRecipe != null) { debug += Common.NewLine + "OneRecipePerDisplayOnRandom = true" + Common.NewLine + "Last Recipe: " + randomRestockRecipe.GenericName; recipe = randomRestockRecipe; } if (settings != null) { debug += Common.NewLine + "Reading user settings..."; if (Cupcake.Settings.Debugging) { debug += Common.NewLine + "Choices:"; foreach (KeyValuePair <string, List <Quality> > val in settings) { debug += Common.NewLine + val.Key; foreach (Quality val2 in val.Value) { debug += Common.NewLine + val2.ToString(); } } } string pick = ""; if (settings.Count > 0) { List <string> tempList = new List <string>(); tempList.AddRange(settings.Keys); pick = RandomUtil.GetRandomObjectFromList <string>(tempList); if (Recipe.NameToRecipeHash.ContainsKey(pick)) { recipe = Recipe.NameToRecipeHash[pick]; debug += Common.NewLine + "Fetching random recipe..."; debug += Common.NewLine + "Pick: " + recipe.Key; } else { debug += Common.NewLine + "Failed to find defined recipe: " + pick; continue; } } else { debug += Common.NewLine + "Settings for slot was 0 count."; continue; } quality = RandomUtil.GetRandomObjectFromList <Quality>(Cupcake.Settings.mDisplayRestockSettings[display.ObjectId][slot.Key][pick]); debug += Common.NewLine + "Fetching random quality..."; debug += Common.NewLine + "Pick: " + quality.ToString(); } bool tryCake = false; if (random && Cupcake.Settings.mStockWeddingCakes && !Cupcake.Settings.SlotHasSettings(display.ObjectId, slot.Key)) { List <string> cakes = new List <string> { "BSBakeWeddingCake", "WeddingCakeSliceDOT07" }; tryCake = true; if (GameUtils.IsInstalled(ProductVersion.EP4)) { cakes.Add("Wedding Cake Slice"); } if ((displayType == DisplayHelper.DisplayTypes.Chiller && slotsForWeddingCakesChiller.Contains(slot.Key)) || (displayType == DisplayHelper.DisplayTypes.Rack && slotsForWeddingCakesOnRack.Contains(slot.Key))) { debug += Common.NewLine + "Wedding cake slot"; recipe = null; while (recipe == null) { string pick = RandomUtil.GetRandomObjectFromList <string>(cakes); if (!Recipe.NameToRecipeHash.TryGetValue(pick, out recipe)) { // for folks with out of date mods if (pick == "BSBakeWeddingCake") { break; } } } } } if (recipe != null) { if (quality == Quality.Any) { // EA standard apparently doesn't handle this correctly... quality = RandomUtil.GetRandomObjectFromList <Quality>(qualites); } // Catalog recipes IGameObject cake = null; if (recipe.Key == "WeddingCakeSliceDOT07") { debug += Common.NewLine + "Attempt at Monte Vista cake"; cake = GlobalFunctions.CreateObjectOutOfWorld("foodServeCakeWeddingDOT07", ~ProductVersion.Undefined); if (cake is FailureObject) { cake = GlobalFunctions.CreateObjectOutOfWorld("foodServeCakeWeddingDOT07", ProductVersion.BaseGame); } } else if (recipe.Key == "Wedding Cake Slice") { debug += Common.NewLine + "Attempt at Generations cake"; cake = GlobalFunctions.CreateObjectOutOfWorld("foodServeCakeWeddingTraditional", ProductVersion.EP4); if (cake is FailureObject) { cake = GlobalFunctions.CreateObjectOutOfWorld("foodServeCakeWeddingTraditional", ProductVersion.BaseGame); } } else if (((tryCake && cake is FailureObject) || recipe.Key == "BSBakeWeddingCake")) { debug += Common.NewLine + "Attempt at Store Wedding cake"; cake = GlobalFunctions.CreateObjectOutOfWorld("foodServeCakeWeddingBakery", ~ProductVersion.Undefined); if (cake is FailureObject) { cake = GlobalFunctions.CreateObjectOutOfWorld("foodServeCakeWeddingBakery", ProductVersion.BaseGame); } } else if (recipe.Key == "BSBakeBirthdayCake") { debug += Common.NewLine + "Attempt at Store Birthday cake"; cake = GlobalFunctions.CreateObjectOutOfWorld("FoodBirthdayCakeBakery", ~ProductVersion.Undefined); if (cake is FailureObject) { cake = GlobalFunctions.CreateObjectOutOfWorld("FoodBirthdayCakeBakery", ProductVersion.BaseGame); } } else { container = recipe.CreateFinishedFood(recipe.CanMakeGroupServing ? Recipe.MealQuantity.Group : Recipe.MealQuantity.Single, quality); } if (cake != null) { if (cake is FailureObject) { debug += Common.NewLine + "Cake was FailureObject"; try { cake.Destroy(); } catch { } continue; } debug += Common.NewLine + "Cake success"; DisplayHelper.ParentToSlot(cake as GameObject, slot.Value, display); cake.AddToWorld(); InitInteractions(cake as GameObject); } if (container != null) { if (container is FailureObject) { debug += Common.NewLine + "Container was FailureObject"; try { container.Destroy(); } catch { } continue; } DisplayHelper.ParentToSlot(container as GameObject, slot.Value, display); container.SetGeometryState(recipe.SingleServingContainer); // this is how EA sets it, don't ask container.AddToWorld(); ServingContainer container2 = container as ServingContainer; if (container2 != null) { int[] numArray = new int[] { 0, 0, 0, 0, 0, 0, 15, 30, 0x2d, 60, 0x4b, 100, 0x65 }; container2.CookingProcess.FoodPoints = numArray[(int)quality]; container2.CookingProcess.FoodState = FoodCookState.Cooked; container2.FoodCookStateChanged(container2.CookingProcess.FoodState); } InitInteractions(container as GameObject); debug += Common.NewLine + "Success: " + recipe.GenericName + Common.NewLine + quality.ToString(); } } } else { debug += Common.NewLine + "Slot contained object: " + containedObject.CatalogName; } } display.AddInteractionsToChildObjects(); }