public static string GetLocalizedName(Role role) { string result = role.TooltipTitleKey; if (!string.IsNullOrEmpty(result)) { string roleName; if (!Localization.GetLocalizedString(result, out roleName)) { return(roleName); } return(result); } ShoppingRegister register = role.RoleGivingObject as ShoppingRegister; if ((register != null) && (role.mSim != null)) { return(register.RegisterRoleName(role.mSim.IsFemale)); } else { result = role.CareerTitleKey; string roleName; if (!Localization.GetLocalizedString(result, out roleName)) { return(roleName); } return(result); } }
protected static ListenerAction OnNewObject(Event e) { ShoppingRegister targetObject = e.TargetObject as ShoppingRegister; if (targetObject != null) { AddInteractions(targetObject); } // OnBroughtObject(e); return(ListenerAction.Keep); }
public static GameObject ReturnTaxCollector(TaxCollector active, List <GameObject> objects) { ThumbnailKey thumbnail = ThumbnailKey.kInvalidThumbnailKey; string text = string.Empty; List <ObjectPicker.RowInfo> list = new List <ObjectPicker.RowInfo>(); foreach (GameObject t in objects) { List <ObjectPicker.ColumnInfo> list2 = new List <ObjectPicker.ColumnInfo>(); int num = 0; thumbnail = t.GetThumbnailKey(); if (t.GetType() == typeof(TaxCollector)) { text = (t as TaxCollector).info.Name; num = (t as TaxCollector).info.Funds; } if (t.GetType() == typeof(DonationBox)) { text = (t as DonationBox).info.Name; num = (t as DonationBox).info.Funds; } //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(CommonMethodsTaxCollector.LocalizeString("Funds", new object[0]), CommonMethodsTaxCollector.LocalizeString("Funds", new object[0]))); list4.Add(new ObjectPicker.TabInfo("coupon", ShoppingRegister.LocalizeString("AvailableConcessionsFoods", new object[0]), list)); List <ObjectPicker.RowInfo> list5 = TaxCollectorSimpleDialog.Show(CommonMethodsTaxCollector.LocalizeString("TransferToObject", new object[0]), 0, list4, list3, true); if (list5 == null || list5.Count != 1) { return(null); } return(list5[0].Item as GameObject); }
/// <summary> /// Overrided shopping dialogue /// </summary> /// <param name="sim"></param> /// <param name="register"></param> /// <returns></returns> public static bool ShowCustomShoppingDialog(Sim sim, ShoppingRegister register, Dictionary <string, List <StoreItem> > itemDictionary) { float num = 1f; if ((sim != null) && sim.HasTrait(TraitNames.Haggler)) { num *= 1f - (TraitTuning.HagglerSalePercentAdd / 100f); } num = (1f - num) * 100f; if (itemDictionary.Count == 0) { return(false); } ShoppingModel.CurrentStore = register; ShoppingRabbitHole.StartShopping(sim, itemDictionary, register.PercentModifier, (float)((int)num), 0, null, sim.Inventory, null, new ShoppingRabbitHole.ShoppingFinished(FinishedCallBack), new ShoppingRabbitHole.CreateSellableCallback(register.CreateSellableObjectsList), register.GetRegisterType != RegisterType.General); return(true); }
/// <summary> /// Returns register type /// </summary> /// <param name="register"></param> /// <returns></returns> public static RegisterType ReturnRegisterType(ShoppingRegister register) { RegisterType type = RegisterType.General; if (register.GetType() == typeof(FoodStoreRegister)) { type = RegisterType.Food; } if (register.GetType() == typeof(BookStoreRegister)) { type = RegisterType.Books; } if (register.GetType() == typeof(NectarRegister)) { type = RegisterType.Nectar; } return(type); }
protected static bool ShowShoppingDialog(ShoppingRegister ths, Sim sim) { float num = (1f - ths.GetSalePercentage(sim)) * 100f; Dictionary<object, IList> objectsForSale = Consignments.Cleanup(null); Dictionary<string, List<StoreItem>> itemDictionary = ths.ItemDictionary(sim); // ItemDictionary will remove objects from the Consignment list, but not delete them, correct for that now Consignments.ValidateObjectForSale(objectsForSale); if (itemDictionary.Count == 0x0) { return false; } ShoppingRabbitHole.CreateSellableCallback createSellableCallback = ths.CreateSellableObjectsList; if (ths is ConsignmentRegister) { createSellableCallback = CreateConsignmentObjectsList; } else if (ths is PotionShopConsignmentRegister) { createSellableCallback = CreatePotionObjectsList; } else if (ths is BotShopRegister) { createSellableCallback = CreateFutureObjectsList; } else if (ths is PetstoreRegister) { createSellableCallback = CreatePetObjectsList; } ShoppingModel.CurrentStore = ths; ShoppingRabbitHole.StartShopping(sim, itemDictionary, ths.PercentModifier, (float)((int)num), 0x0, null, sim.Inventory, null, ths.FinishedCallBack, createSellableCallback, ths.GetRegisterType != RegisterType.General); return true; }
protected static bool ShowShoppingDialog(ShoppingRegister ths, Sim sim) { float num = (1f - ths.GetSalePercentage(sim)) * 100f; Dictionary <object, IList> objectsForSale = Consignments.Cleanup(null); Dictionary <string, List <StoreItem> > itemDictionary = ths.ItemDictionary(sim); // ItemDictionary will remove objects from the Consignment list, but not delete them, correct for that now Consignments.ValidateObjectForSale(objectsForSale); if (itemDictionary.Count == 0x0) { return(false); } ShoppingRabbitHole.CreateSellableCallback createSellableCallback = ths.CreateSellableObjectsList; if (ths is ConsignmentRegister) { createSellableCallback = CreateConsignmentObjectsList; } else if (ths is PotionShopConsignmentRegister) { createSellableCallback = CreatePotionObjectsList; } else if (ths is BotShopRegister) { createSellableCallback = CreateFutureObjectsList; } else if (ths is PetstoreRegister) { createSellableCallback = CreatePetObjectsList; } ShoppingModel.CurrentStore = ths; ShoppingRabbitHole.StartShopping(sim, itemDictionary, ths.PercentModifier, (float)((int)num), 0x0, null, sim.Inventory, null, ths.FinishedCallBack, createSellableCallback, ths.GetRegisterType != RegisterType.General); return(true); }
protected static void DisplayStory(SimDescription sim, List <Pair <int, IGameObject> > list, int totalSale, bool unsold, string bornSalesmanName, Curve reputationVsStoreFeeCurve, int numberOfTopSellingItems, float makeXSimoleonsOpportunityConsignmentFeeMultiplier) { try { int reportGate = Consigner.Settings.mReportGate; Consignment consignment = sim.SkillManager.AddElement(SkillNames.Consignment) as Consignment; if (list.Count > 0x0) { float num7 = Math.Max((float)1f, (float)(totalSale * reputationVsStoreFeeCurve.Fx(consignment.Reputation))); if (consignment.OppMoneyMadeLifetimeOpportunityCompleted) { num7 *= makeXSimoleonsOpportunityConsignmentFeeMultiplier; } StringBuilder builder = new StringBuilder(); builder.Append(ShoppingRegister.LocalizeString("ItemsSoldHeader", new object[] { totalSale, (int)num7 })); builder.Append(Common.NewLine); builder.Append(Common.NewLine); list.Sort(delegate(Pair <int, IGameObject> x, Pair <int, IGameObject> y) { return(y.First - x.First); }); for (int i = 0; (i < numberOfTopSellingItems) && (i < list.Count); i++) { try { builder.Append(ShoppingRegister.LocalizeString("ItemSoldBullet", new object[] { list[i].Second.GetLocalizedName(), list[i].First })); builder.Append(Common.NewLine); } catch { } } if (sim.TraitManager.HasElement(TraitNames.SuaveSeller)) { builder.Append(ShoppingRegister.LocalizeString("SuaveSellerMention", new object[] { sim.CreatedSim })); } if (!string.IsNullOrEmpty(bornSalesmanName)) { builder.Append(ShoppingRegister.LocalizeString("PositiveFeedbackMention", new object[] { bornSalesmanName })); builder.Append(Common.NewLine); builder.Append(Common.NewLine); } if (unsold) { builder.Append(ShoppingRegister.LocalizeString("SomeItemsUnsold", new object[0x0])); } if (SimTypes.IsSelectable(sim)) { sim.CreatedSim.ShowTNSAndPlayStingIfSelectable(builder.ToString(), StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid, sim.CreatedSim.ObjectId, "sting_sales_succes"); } else if ((totalSale > reportGate) && ((!sStoryProgressionMatchesAlertLevel.Valid) || (sStoryProgressionMatchesAlertLevel.Invoke <bool>(new object[] { "Money", sim })))) { StyledNotification.Format format = new StyledNotification.Format(builder.ToString(), ObjectGuid.InvalidObjectGuid, sim.CreatedSim.ObjectId, StyledNotification.NotificationStyle.kGameMessagePositive); StyledNotification.Show(format); } sim.ModifyFunds(totalSale - ((int)num7)); sStoryProgressionAdjustFunds.Invoke <bool>(new object[] { sim, "Consignment", totalSale - ((int)num7) }); foreach (Pair <int, IGameObject> pair in list) { pair.Second.Destroy(); } EventTracker.SendEvent(new IncrementalEvent(EventTypeId.kEarnedMoneyFromSelfEployment, sim.CreatedSim, null, (float)(totalSale - ((int)num7)))); } else if (unsold) { sim.CreatedSim.ShowTNSAndPlayStingIfSelectable(ShoppingRegister.LocalizeString("AllItemsUnsold", new object[0x0]), StyledNotification.NotificationStyle.kGameMessageNegative, ObjectGuid.InvalidObjectGuid, sim.CreatedSim.ObjectId, "sting_sales_fail"); } } catch (Exception e) { Common.DebugException(sim, e); } }
public override bool Run() { Definition interactionDefinition = base.InteractionDefinition as Definition; if (interactionDefinition == null) { return(false); } ObjectGuid mObject = interactionDefinition.mObject; int mCost = interactionDefinition.mCost; if (mObject == ObjectGuid.InvalidObjectGuid) { List <ObjectGuid> objectsICanBuyInDisplay = DisplayHelper.GetObjectsICanBuyInDisplay(base.Actor, base.Target); if (!Autonomous && Actor.IsSelectable) { List <ObjectPicker.RowInfo> list = new List <ObjectPicker.RowInfo>(); foreach (ObjectGuid current in objectsICanBuyInDisplay) { GameObject obj = GlobalFunctions.ConvertGuidToObject <GameObject>(current); ObjectPicker.RowInfo item = new ObjectPicker.RowInfo(current, new List <ObjectPicker.ColumnInfo> { new ObjectPicker.ThumbAndTextColumn(obj.GetThumbnailKey(), obj.GetLocalizedName()), new ObjectPicker.MoneyColumn(DisplayHelper.ComputeFinalPriceOnObject(obj, true)) }); list.Add(item); } List <ObjectPicker.HeaderInfo> list2 = new List <ObjectPicker.HeaderInfo>(); List <ObjectPicker.TabInfo> list3 = new List <ObjectPicker.TabInfo>(); list2.Add(new ObjectPicker.HeaderInfo(ShoppingRegister.sLocalizationKey + ":BuyFoodColumnName", ShoppingRegister.sLocalizationKey + ":BuyFoodColumnTooltip", 200)); list2.Add(new ObjectPicker.HeaderInfo("Ui/Caption/Shopping/Cart:Price", "Ui/Tooltip/Shopping/Cart:Price")); list3.Add(new ObjectPicker.TabInfo("", ShoppingRegister.LocalizeString("AvailableFoods"), list)); List <ObjectPicker.RowInfo> list4 = SimplePurchaseDialog.Show(ShoppingRegister.LocalizeString("BuyFoodTitle"), Actor.FamilyFunds, list3, list2, true); if (list4 == null || list4.Count != 1) { return(false); } mObject = (ObjectGuid)list4[0].Item; mCost = ((ObjectPicker.MoneyColumn)list4[0].ColumnInfo[1]).Value; } else { RandomUtil.RandomizeListOfObjects <ObjectGuid>(objectsICanBuyInDisplay); int familyFunds = base.Actor.FamilyFunds; for (int i = 0; i < objectsICanBuyInDisplay.Count; i++) { int cost = DisplayHelper.ComputeFinalPriceOnObject(objectsICanBuyInDisplay[i]); if (cost <= familyFunds) { //Definition continuationDefinition = new Definition(objectsICanBuyInDisplay[i], cost, false); //base.TryPushAsContinuation(continuationDefinition); //return true; mObject = objectsICanBuyInDisplay[i]; mCost = cost; break; } } //return false; } } if (mObject == ObjectGuid.InvalidObjectGuid) { return(false); } if (!base.Actor.RouteToObjectRadialRange(base.Target, 0f, base.Target.MaxProximityBeforeSwiping())) { return(false); } base.Actor.RouteTurnToFace(base.Target.Position); if (!DisplayHelper.GetObjectsICanBuyInDisplay(base.Actor, base.Target).Contains(mObject)) { return(false); } if (base.Actor.FamilyFunds < mCost) { return(false); } GameObject target = GlobalFunctions.ConvertGuidToObject <GameObject>(mObject); if (target == null) { return(false); } base.StandardEntry(); base.BeginCommodityUpdates(); string swipeAnimationName = base.Target.GetSwipeAnimationName(target); if (Actor.SimDescription.Child) { swipeAnimationName = "c" + swipeAnimationName.Substring(1); } base.Actor.PlaySoloAnimation(swipeAnimationName, true); VisualEffect effect = VisualEffect.Create(base.Target.GetSwipeVfxName()); Vector3 zero = Vector3.Zero; Vector3 axis = Vector3.Zero; if (Slots.AttachToBone(effect.ObjectId, base.Target.ObjectId, ResourceUtils.HashString32("transformBone"), false, ref zero, ref axis, 0f) == TransformParentingReturnCode.Success) { effect.SetAutoDestroy(true); effect.Start(); } else { effect.Dispose(); effect = null; } //bool flag = false; //bool flag2 = false; bool succeeded = false; bool addInteractions = true; string tnsKey = null; if (target.IsLiveDraggingEnabled() && !target.InUse && (interactionDefinition.mPushEat || (target.ItemComp != null && target.ItemComp.CanAddToInventory(base.Actor.Inventory) && base.Actor.Inventory.CanAdd(target)))) //&& base.Actor.Inventory.TryToAdd(target))) { ServingContainerGroup groupServing = null; if (interactionDefinition.mSingleServing) { groupServing = target as ServingContainerGroup; if (groupServing != null) { target = groupServing.CookingProcess.CreateSingleServingOfFood(groupServing, true, true); addInteractions = false; } } if (interactionDefinition.mPushEat) { target.SetOpacity(0f, 0f); if (Actor.ParentToRightHand(target)) { succeeded = true; CarrySystem.EnterWhileHolding(Actor, target as ICarryable); } target.FadeIn(); } else if (Actor.Inventory.TryToAdd(target)) { succeeded = true; tnsKey = "PlacedInPersonalInventory"; } if (succeeded) { if (groupServing != null) { groupServing.DecrementServings(); if (groupServing.NumServingsLeft == 0) { groupServing.FadeOut(false, true); } } } else if (groupServing != null && target != null) { target.Destroy(); } } else if (!target.InUse && base.Actor.Household.SharedFamilyInventory.Inventory.TryToAdd(target)) { succeeded = true; tnsKey = "PlacedInFamilyInventory"; } //bool succeeded = flag || flag2; if (succeeded) { if (addInteractions) { Target.OnHandToolChildUnslotted(target, Slot.None); if (target is Snack) { target.AddInteraction(Sims3.Gameplay.Objects.CookingObjects.Eat.Singleton, true); target.AddInteraction(Snack_CleanUp.Singleton, true); } } /*if (flag2) * { * base.Actor.ShowTNSIfSelectable(CraftersConsignment.LocalizeString(base.Actor.IsFemale, "PlacedInFamilyInventory", new object[] { base.Actor, target }), StyledNotification.NotificationStyle.kGameMessagePositive); * } * else * { * base.Actor.ShowTNSIfSelectable(CraftersConsignment.LocalizeString(base.Actor.IsFemale, "PlacedInPersonalInventory", new object[] { base.Actor, target }), StyledNotification.NotificationStyle.kGameMessagePositive); * }*/ if (tnsKey != null) { Actor.ShowTNSIfSelectable(CraftersConsignment.LocalizeString(Actor.IsFemale, tnsKey, new object[] { Actor, target }), StyledNotification.NotificationStyle.kGameMessagePositive); } base.Target.GiveMarkupBuffs(base.Actor, mObject); base.Actor.ModifyFunds(-mCost); base.Target.GiveLotOwnerMoney(mCost, base.Actor); base.Target.AccumulateRevenue(mCost); if (interactionDefinition.mPushEat) { (target as IFoodContainer).PushEatHeldFoodInteraction(Actor); } } base.EndCommodityUpdates(succeeded); base.StandardExit(); return(succeeded); }
public static string GetStatus(SimDescription sim) { string str = sim.FullName; bool serviceOrRole = false; if (sim.AssignedRole != null) { serviceOrRole = true; ShoppingRegister register = sim.AssignedRole.RoleGivingObject as ShoppingRegister; if (register != null) { str += ", " + register.RegisterRoleName(sim.IsFemale); } else { string roleName; if (Localization.GetLocalizedString(sim.AssignedRole.CareerTitleKey, out roleName)) { str += ", " + roleName; } } string hours = GetRoleHours(sim); if (!string.IsNullOrEmpty(hours)) { str += Common.NewLine + hours; } } else if (SimTypes.InServicePool(sim)) { serviceOrRole = true; string serviceName; if (Localization.GetLocalizedString("Ui/Caption/Services/Service:" + sim.CreatedByService.ServiceType.ToString(), out serviceName)) { str += ", " + serviceName; } } if ((serviceOrRole) || (Tagger.Settings.mTagDataSettings[TagDataType.Orientation] && Tagger.Settings.mTagDataSettings[TagDataType.LifeStage] && (Tagger.Settings.mTagDataSettings[TagDataType.AgeInDays] || (Tagger.Settings.mTagDataSettings[TagDataType.DaysTillNextStage] && sim.AgingEnabled)))) { str += Common.NewLine; } else { str += " - "; } if (sim.TeenOrAbove && !sim.IsPet && Tagger.Settings.mTagDataSettings[TagDataType.Orientation]) { str += Common.Localize("SimType:" + TagDataHelper.GetOrientation(sim).ToString()); } if (Tagger.Settings.mTagDataSettings[TagDataType.LifeStage]) { if (Tagger.Settings.mTagDataSettings[TagDataType.Orientation]) { str += " "; } str += sim.AgeLocalizedText; } if (Tagger.Settings.mTagDataSettings[TagDataType.AgeInDays] || Tagger.Settings.mTagDataSettings[TagDataType.DaysTillNextStage]) { str += " ("; } if (Tagger.Settings.mTagDataSettings[TagDataType.AgeInDays]) { str += Common.Localize("TagData:Age", sim.IsFemale, new object[] { Math.Round(Aging.GetCurrentAgeInDays(sim as IMiniSimDescription)) }); } if (sim.AgingEnabled) { if (Tagger.Settings.mTagDataSettings[TagDataType.DaysTillNextStage]) { str += ", " + Common.Localize("TagData:Birthday", sim.IsFemale, new object[] { (int)(AgingManager.Singleton.AgingYearsToSimDays(AgingManager.GetMaximumAgingStageLength(sim)) - AgingManager.Singleton.AgingYearsToSimDays(sim.AgingYearsSinceLastAgeTransition)) }); } } if (Tagger.Settings.mTagDataSettings[TagDataType.AgeInDays] || Tagger.Settings.mTagDataSettings[TagDataType.DaysTillNextStage]) { str += ")"; } if (Tagger.Settings.mTagDataSettings[TagDataType.Occult] && sim.OccultManager != null) { List <OccultTypes> types = OccultTypeHelper.CreateList(sim, false); if (types.Count > 0) { str += Common.NewLine; string occultString = ""; foreach (OccultTypes type in types) { occultString += ", " + OccultTypeHelper.GetLocalizedName(type); } str += Common.Localize("TagData:OccultTag", sim.IsFemale, new object[] { occultString.Remove(0, 2) }); } } Sim createdSim = sim.CreatedSim; if (Tagger.Settings.Debugging) { if (createdSim != null) { str += Common.NewLine + "Autonomy: "; if (createdSim.Autonomy == null) { str += "None"; } else { if (createdSim.Autonomy.AutonomyDisabled) { str += "Disabled"; } else if (!AutonomyRestrictions.IsAnyAutonomyEnabled(createdSim)) { str += "User Disabled"; } else if (createdSim.Autonomy.IsRunningHighLODSimulation) { str += "High"; } else { str += "Low"; } if (createdSim.Autonomy.ShouldRunLocalAutonomy) { str += " Local"; } if (createdSim.CanRunAutonomyImmediately()) { str += " Ready"; } else if (!createdSim.mLastInteractionWasAutonomous) { str += " Push"; } else if (!createdSim.mLastInteractionSucceeded) { str += " Fail"; } if (createdSim.Autonomy.InAutonomyManagerQueue) { str += " Queued"; } } } } if (createdSim != null) { if (Tagger.Settings.mTagDataSettings[TagDataType.Mood]) { str += Common.NewLine; int flavour = (int)createdSim.MoodManager.MoodFlavor; str += Common.Localize("TagData:MoodTag", sim.IsFemale, new object[] { Common.LocalizeEAString(false, "Ui/Tooltip/HUD/SimDisplay:MoodFlavor" + flavour.ToString()) }) + " "; } if (Tagger.Settings.mTagDataSettings[TagDataType.MotiveInfo]) { if (!Tagger.Settings.mTagDataSettings[TagDataType.Mood]) { str += Common.NewLine; } string motives = ", "; int num = 0; foreach (CommodityKind kind in (Sims3.UI.Responder.Instance.HudModel as HudModel).GetMotives(sim.CreatedSim)) { if (sim.CreatedSim.Motives.HasMotive(kind)) { if (num >= 6) { break; } motives += FetchMotiveLocalization(sim.Species, kind) + ": " + "(" + sim.CreatedSim.Motives.GetValue(kind).ToString("0.") + ") "; } num++; } str += Common.Localize("TagData:Motives", sim.IsFemale, new object[] { motives.Remove(0, 2) }); } if (Tagger.Settings.mTagDataSettings[TagDataType.CurrentInteraction] && createdSim.CurrentInteraction != null) { str += Common.NewLine; try { str += createdSim.CurrentInteraction.ToString(); } catch (Exception e) { Common.DebugException(createdSim, e); str += createdSim.CurrentInteraction.GetType(); } Tone tone = createdSim.CurrentInteraction.CurrentTone; if (tone != null) { str += Common.NewLine + tone.ToString(); } SocialInteractionBase social = createdSim.CurrentInteraction as SocialInteractionBase; if ((social != null) && (social.Target != null)) { str += " " + Common.Localize("TagData:With", sim.IsFemale, new object[] { social.Target.Name }); } if (createdSim.CurrentInteraction is Terrain.GoHereWith) { InviteToLotSituation situtation = InviteToLotSituation.FindInviteToLotSituationInvolving(createdSim); if (situtation != null) { if (situtation.SimA != createdSim) { str += " " + situtation.SimA.Name; } else if (situtation.SimB != createdSim) { str += situtation.SimB.Name; } } } } } if (!SimTypes.IsSpecial(sim)) { str += Common.NewLine + Common.Localize("TagData:CashTag", sim.IsFemale, new object[] { sim.FamilyFunds }); if ((Tagger.Settings.mTagDataSettings[TagDataType.Debt] || Tagger.Settings.mTagDataSettings[TagDataType.NetWorth]) && sGetDebtAndNetworth.Valid) { int bit = 0; if (Tagger.Settings.mTagDataSettings[TagDataType.Debt]) { bit = bit + 1; } if (Tagger.Settings.mTagDataSettings[TagDataType.NetWorth]) { bit = bit + 4; } str += sGetDebtAndNetworth.Invoke <string>(new object[] { sim, bit }); } if (Tagger.Settings.mTagDataSettings[TagDataType.Job]) { if (sim.Occupation != null) { str += Common.NewLine; if (sim.Occupation.OfficeLocation != null) { str += Common.Localize("TagData:JobAt", sim.IsFemale, new object[] { sim.Occupation.CurLevelJobTitle, sim.Occupation.OfficeLocation.GetLocalizedName() }); } else { str += Common.Localize("TagData:JobTag", sim.IsFemale, new object[] { sim.Occupation.CurLevelJobTitle }); } } } if (Tagger.Settings.mTagDataSettings[TagDataType.PartnerInfo]) { if (sim.Partner != null) { Relationship rel = sim.GetRelationship(sim.Partner, false); string status = "Happily"; if (rel != null) { if (rel.CurrentLTRLiking < -15) { status = "Unhappily"; } } str += Common.NewLine; if (sim.IsMarried) { str += Common.Localize("TagData:Spouse", sim.IsFemale, new object[] { Common.Localize("TagData:" + status), sim.Partner }); } else { str += Common.Localize("TagData:Partner", sim.IsFemale, new object[] { sim.Partner }); } } } } if (sim.IsPregnant && Tagger.Settings.mTagDataSettings[TagDataType.PregnancyInfo]) { IMiniSimDescription father = SimDescription.Find(sim.Pregnancy.DadDescriptionId); if (father == null) { father = MiniSimDescription.Find(sim.Pregnancy.DadDescriptionId); } str += Common.NewLine; if (father != null) { if (sim.Partner != null && father != sim.Partner && !sim.IsPet) { string uhoh = Common.Localize("TagData:Uhoh"); str += Common.Localize("TagData:Pregnancy", sim.IsFemale, new object[] { father, uhoh }); } else { str += Common.Localize("TagData:Pregnancy", sim.IsFemale, new object[] { father }); } } else { str += Common.Localize("TagData:PregnancyUnknown", sim.IsFemale); } } if (Tagger.Settings.mTagDataSettings[TagDataType.PersonalityInfo] && sGetClanInfo.Valid) { List <string> info = sGetClanInfo.Invoke <List <string> >(new object [] { sim }); foreach (string personality in info) { str += Common.NewLine + personality; } } return(str); }
// Methods public override bool Test(Sim a, Sim target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { return(ShoppingRegister.TestIfSocialValid(a, target)); }
public BaseFoodStand.BaseFoodData ShowBuyConcessionsFoodDialog(bool autonomous) { List <ushort> availibleFoodGuids = GetAvailibleFoodGuids(BaseFoodStand.FoodType.None, base.Actor); ThumbnailKey thumbnail = ThumbnailKey.kInvalidThumbnailKey; string text = string.Empty; List <ObjectPicker.RowInfo> list = new List <ObjectPicker.RowInfo>(); List <BaseFoodStand.BaseFoodData> foods = new List <BaseFoodStand.BaseFoodData>(); foreach (ushort current in availibleFoodGuids) { BaseFoodStand.BaseFoodData baseFoodData = null; if (ConcessionsStand.SeasonalFoodData.sSeasonalFoodData.TryGetValue(current, out baseFoodData)) { List <ObjectPicker.ColumnInfo> list2 = new List <ObjectPicker.ColumnInfo>(); bool addToList = false; switch (baseFoodData.FoodType) { case ConcessionsStand.FoodType.HotBeverage: { thumbnail = GetThumbnailKeyForDrink(baseFoodData.FoodType == BaseFoodStand.FoodType.HotBeverage); text = Localization.LocalizeString(ConcessionsStand.sBaseBeverageLocKey + baseFoodData.DrinkNameLocKey, new object[0]); addToList = true; foods.Add(baseFoodData); break; } } if (addToList) { list2.Add(new ObjectPicker.ThumbAndTextColumn(thumbnail, text)); int num = AddMenuItem.ReturnCoffeePrice(); list2.Add(new ObjectPicker.MoneyColumn(num)); ObjectPicker.RowInfo item = new ObjectPicker.RowInfo(current, list2); list.Add(item); } } } BaseFoodStand.BaseFoodData foodData = null; if (!autonomous) { List <ObjectPicker.HeaderInfo> list3 = new List <ObjectPicker.HeaderInfo>(); List <ObjectPicker.TabInfo> list4 = new List <ObjectPicker.TabInfo>(); list3.Add(new ObjectPicker.HeaderInfo(ShoppingRegister.sLocalizationKey + ":BuyConcessionsFoodColumnName", ShoppingRegister.sLocalizationKey + ":BuyConcessionsFoodColumnTooltip", 200)); list3.Add(new ObjectPicker.HeaderInfo("Ui/Caption/Shopping/Cart:Price", "Ui/Tooltip/Shopping/Cart:Price")); list4.Add(new ObjectPicker.TabInfo("coupon", ShoppingRegister.LocalizeString("AvailableConcessionsFoods", new object[0]), list)); List <ObjectPicker.RowInfo> list5 = SimplePurchaseDialog.Show(ShoppingRegister.LocalizeString("BuyConcessionsFoodTitle", new object[0]), base.Actor.Household.FamilyFunds, list4, list3, true); if (list5 == null || list5.Count != 1) { return(null); } foodData = list5[0].Item as BaseFoodStand.BaseFoodData; CommonMethods.ShowMessage(list5.Count.ToString()); CommonMethods.ShowMessage(list5[0].Item.ToString()); if (foodData == null) { CommonMethods.ShowMessage("foodData null"); } } else { foodData = RandomUtil.GetRandomObjectFromList <BaseFoodStand.BaseFoodData>(foods); } return(foodData); }
/// <summary> /// Returns register type /// </summary> /// <param name="register"></param> /// <returns></returns> public static RegisterType ReturnRegisterType(ShoppingRegister register) { RegisterType type = RegisterType.General; if (register.GetType() == typeof(FoodStoreRegister)) type = RegisterType.Food; if (register.GetType() == typeof(BookStoreRegister)) type = RegisterType.Books; if (register.GetType() == typeof(NectarRegister)) type = RegisterType.Nectar; return type; }
/// <summary> /// Overrided shopping dialogue /// </summary> /// <param name="sim"></param> /// <param name="register"></param> /// <returns></returns> public static bool ShowCustomShoppingDialog(Sim sim, ShoppingRegister register, Dictionary<string, List<StoreItem>> itemDictionary) { float num = 1f; if ((sim != null) && sim.HasTrait(TraitNames.Haggler)) { num *= 1f - (TraitTuning.HagglerSalePercentAdd / 100f); } num = (1f - num) * 100f; if (itemDictionary.Count == 0) { return false; } ShoppingModel.CurrentStore = register; ShoppingRabbitHole.StartShopping(sim, itemDictionary, register.PercentModifier, (float)((int)num), 0, null, sim.Inventory, null, new ShoppingRabbitHole.ShoppingFinished(FinishedCallBack), new ShoppingRabbitHole.CreateSellableCallback(register.CreateSellableObjectsList), register.GetRegisterType != RegisterType.General); return true; }