private void Spawn(Vec2 position, TroopRoster party, TroopRoster prisoners) { var partyClan = GetMostPrevalent(party) ?? Clan.BanditFactions.First(); MobileParty = ModBanditMilitiaPartyComponent.CreateBanditParty(partyClan); MobileParty.InitializeMobilePartyAroundPosition(party, prisoners, position, 0); PartyMilitiaMap.Add(MobileParty, this); PartyImageMap.Add(MobileParty, new ImageIdentifierVM(Banner)); var leaderHero = MobileParty.MemberRoster.GetTroopRoster().ToListQ()[0].Character.HeroObject; MobileParty.PartyComponent.ChangePartyLeader(leaderHero); Hero = MobileParty.LeaderHero; Hero.Gold = Convert.ToInt32(MobileParty.Party.TotalStrength * Globals.GoldMap[Globals.Settings.GoldReward.SelectedValue]); if (MobileParty.ActualClan.Leader is null) { MobileParty.ActualClan.SetLeader(Hero); } if (MobileParty.MemberRoster.GetTroopRoster().Any(t => t.Character.IsMounted)) { var mount = Mounts.GetRandomElement(); Hero.BattleEquipment[10] = new EquipmentElement(mount); if (mount.HorseComponent.Monster.MonsterUsage == "camel") { Hero.BattleEquipment[11] = new EquipmentElement(Saddles.Where(saddle => saddle.Name.ToString().ToLower().Contains("camel")).ToList().GetRandomElement()); } else { Hero.BattleEquipment[11] = new EquipmentElement(Saddles.Where(saddle => !saddle.Name.ToString().ToLower().Contains("camel")).ToList().GetRandomElement()); } } var getLocalizedText = AccessTools.Method(typeof(MBTextManager), "GetLocalizedText"); Name = (string)getLocalizedText.Invoke(null, new object[] { $"{Possess(Hero.FirstName.ToString())} Bandit Militia" }); MobileParty.SetCustomName(new TextObject(Name)); MobileParty.LeaderHero.StringId += "Bandit_Militia"; MobileParty.ShouldJoinPlayerBattles = true; var tracker = Globals.MobilePartyTrackerVM?.Trackers?.FirstOrDefault(t => t.TrackedParty == MobileParty); if (Globals.Settings.Trackers && tracker is null && MobileParty.MemberRoster.TotalManCount >= Globals.Settings.TrackedSizeMinimum) { tracker = new MobilePartyTrackItemVM(MobileParty, MapScreen.Instance.MapCamera, null); Globals.MobilePartyTrackerVM?.Trackers?.Add(tracker); }
public async static Task GenerateProductList() { var saddles = await App.storeManager.SaddleStore.GetItemsAsync(false, true); var accessory = await App.storeManager.AccessoryStore.GetItemsAsync(false, true); var service = await App.storeManager.ServiceStore.GetItemsAsync(false, true); var saddle_attrs = await App.storeManager.SaddleStore.GetSaddleAttributes(); var saddle_values = await App.storeManager.SaddleStore.GetSaddleValue(); var saddke_models = await App.storeManager.SaddleStore.GetSaddleModel(); if (saddle_attrs != null) { SaddleAttributes.AddRange(saddle_attrs); } if (saddke_models != null) { SaddleModels.AddRange(saddke_models); } if (saddle_values != null) { SaddleValues.AddRange(saddle_values); } List <string> SaddleModel = new List <string>(); List <string> SaddleColor = new List <string>(); List <string> SaddleLeather = new List <string>(); List <string> ServiceModel = new List <string>(); List <string> ServiceSubCategoryModel = new List <string>(); List <string> AccessoryModel = new List <string>(); List <string> AccessoryCategory = new List <string>(); List <string> AccessorySubCategory = new List <string>(); if (saddles.Any()) { SaddleModel.AddRange(saddles.Select((arg) => string.IsNullOrWhiteSpace(arg.Name) ? "N.A" : arg.Name)); SaddleLeather.AddRange(saddles.Select((arg) => string.IsNullOrWhiteSpace(arg.Leather) ? "N.A" : arg.Leather)); Saddles.Clear(); Saddles.AddRange(saddles); } if (service.Any()) { ServiceModel.AddRange(service.Select((arg) => string.IsNullOrWhiteSpace(arg.Name) ? "N.A" : arg.Name)); ServiceSubCategoryModel.AddRange(service.Select((arg) => string.IsNullOrWhiteSpace(arg.SubCategoryName) ? "N.A" : arg.SubCategoryName)); Services.Clear(); Services.AddRange(service); } if (accessory.Any()) { AccessoryModel.AddRange(accessory.Select((arg) => string.IsNullOrWhiteSpace(arg.Name) ? "N.A" : arg.Name)); AccessoryCategory.AddRange(accessory.Select((arg) => string.IsNullOrWhiteSpace(arg.CategoryName) ? "N.A" : arg.CategoryName)); AccessorySubCategory.AddRange(accessory.Select((arg) => string.IsNullOrWhiteSpace(arg.SubCategoryName) ? "N.A" : arg.SubCategoryName)); Accessory.Clear(); Accessory.AddRange(accessory); } SaddleModel = SaddleModel.Distinct().ToList(); SaddleColor.Add("Black"); SaddleColor.Add("Brown"); SaddleLeather = SaddleLeather.Distinct().ToList(); ServiceModel = ServiceModel.Distinct().ToList(); ServiceSubCategoryModel = ServiceSubCategoryModel.Distinct().ToList(); AccessoryModel = AccessoryModel.Distinct().ToList(); AccessoryCategory = AccessoryCategory.Distinct().ToList(); AccessorySubCategory = AccessorySubCategory.Distinct().ToList(); foreach (var item in Saddles) { if (string.IsNullOrWhiteSpace(item.Name)) { item.Name = "N.A"; } if (string.IsNullOrWhiteSpace(item.Leather)) { item.Leather = "N.A"; } } foreach (var item in Services) { if (string.IsNullOrWhiteSpace(item.Name)) { item.Name = "N.A"; } if (string.IsNullOrWhiteSpace(item.SubCategoryName)) { item.SubCategoryName = "N.A"; } } foreach (var item in Accessory) { if (string.IsNullOrWhiteSpace(item.Name)) { item.Name = "N.A"; } if (string.IsNullOrWhiteSpace(item.CategoryName)) { item.CategoryName = "N.A"; } if (string.IsNullOrWhiteSpace(item.SubCategoryName)) { item.SubCategoryName = "N.A"; } } Products.Clear(); Products.Add(new Product() { Description = "Saddle", Name = "Saddle", Name_FR = AppResources.P_Saddle, ProductKind = ProductKind.saddle, Properties = new List <ProductProperty>() { new ProductProperty(PropertyType.IsText) { PropertyName = "Rider Name", PropertyValue = null, PropertyName_FR = AppResources.P_RiderName }, new ProductProperty(PropertyType.IsPicker) { PropertyName = "Model", PropertyName_FR = AppResources.P_Model, PropertyValue = null, ItemSource = SaddleModel }, new ProductProperty(PropertyType.IsBoolean) { PropertyName = "2nd Skin", PropertyValue = null, PropertyName_FR = AppResources.P_2ndSkin }, new ProductProperty(PropertyType.IsBoolean) { PropertyName = "RBQ grained", PropertyValue = null, PropertyName_FR = AppResources.P_RBQgrained }, new ProductProperty(PropertyType.IsText) { PropertyName = "Seat", PropertyValue = null, PropertyName_FR = AppResources.P_Seat }, new ProductProperty(PropertyType.IsText) { PropertyName = "Tree", PropertyValue = null, PropertyName_FR = AppResources.P_Tree }, new ProductProperty(PropertyType.IsText) { PropertyName = "Flaps", PropertyValue = null, PropertyName_FR = AppResources.P_Flaps }, new ProductProperty(PropertyType.IsPicker) { PropertyName = "Color", PropertyName_FR = AppResources.P_Color }, new ProductProperty(PropertyType.IsPicker) { PropertyName = "Leather", PropertyName_FR = AppResources.P_Leather }, new ProductProperty(PropertyType.IsPicker) { PropertyName = "Front Block", PropertyValue = null, PropertyName_FR = AppResources.P_FrontBlock }, new ProductProperty(PropertyType.IsPicker) { PropertyName = "Rear Block", PropertyValue = null, PropertyName_FR = AppResources.P_RearBlock }, new ProductProperty(PropertyType.IsPicker) { PropertyName = "Grained", PropertyName_FR = AppResources.P_Grained }, new ProductProperty(PropertyType.IsLabel) { PropertyName = "Unit Price", PropertyName_FR = AppResources.P_UnitPrice, PropertyValue = null }, new ProductProperty(PropertyType.IsPicker) { PropertyName = "Panel Base", PropertyValue = null, PropertyName_FR = AppResources.P_PanelBase }, new ProductProperty(PropertyType.IsText) { PropertyName = "A", PropertyValue = null, PropertyName_FR = "A" }, new ProductProperty(PropertyType.IsText) { PropertyName = "B", PropertyValue = null, PropertyName_FR = "B" }, new ProductProperty(PropertyType.IsText) { PropertyName = "C", PropertyValue = null, PropertyName_FR = "C" }, new ProductProperty(PropertyType.IsText) { PropertyName = "D", PropertyValue = null, PropertyName_FR = "D" }, new ProductProperty(PropertyType.IsText) { PropertyName = "Comments", PropertyValue = null, PropertyName_FR = AppResources.P_Comments }, new ProductProperty(PropertyType.IsBoolean) { PropertyName = "NamePlate", PropertyValue = null, PropertyName_FR = AppResources.P_NamePlate }, new ProductProperty(PropertyType.IsBoolean) { PropertyName = "Greasing", PropertyValue = null, PropertyName_FR = AppResources.P_Greasing }, new ProductProperty(PropertyType.IsBoolean) { PropertyName = "Sp Saddle", PropertyValue = null, PropertyName_FR = AppResources.P_SpSaddle }, new ProductProperty(PropertyType.IsText) { PropertyName = "Note", PropertyValue = null, PropertyName_FR = AppResources.Note } } }); Products.Add(new Product() { Description = "Accessory", Name = "Accessory", Name_FR = AppResources.P_Accessory, ProductKind = ProductKind.accessory, Properties = new List <ProductProperty>() { new ProductProperty(PropertyType.IsPicker) { PropertyName = "Parent Category", PropertyValue = null, AllSource = AccessoryCategory, ItemSource = AccessoryCategory, PropertyName_FR = AppResources.P_ParentCategory }, new ProductProperty(PropertyType.IsPicker) { PropertyName = "Category", PropertyValue = null, AllSource = AccessorySubCategory, ItemSource = AccessorySubCategory, PropertyName_FR = AppResources.P_Category }, new ProductProperty(PropertyType.IsPicker) { PropertyName = "Name", PropertyValue = null, AllSource = AccessoryModel, ItemSource = AccessoryModel, PropertyName_FR = AppResources.Name }, new ProductProperty(PropertyType.IsLabel) { PropertyName = "Unit Price", PropertyValue = null, PropertyName_FR = AppResources.P_UnitPrice }, new ProductProperty(PropertyType.IsLabel) { PropertyName = "Reference", PropertyValue = null, IsVisible = false, PropertyName_FR = AppResources.P_Reference }, new ProductProperty(PropertyType.IsText) { PropertyName = "Note", PropertyValue = null, PropertyName_FR = AppResources.P_Note }, } }); Products.Add(new Product() { Description = "Service", Name = "Service", Name_FR = AppResources.P_Service, ProductKind = ProductKind.service, Properties = new List <ProductProperty>() { new ProductProperty(PropertyType.IsText) { PropertyName = "Serial number", PropertyValue = null, PropertyName_FR = AppResources.P_Serial_number }, new ProductProperty(PropertyType.IsText) { PropertyName = "Brand", PropertyValue = null, PropertyName_FR = AppResources.P_Brand }, new ProductProperty(PropertyType.IsText) { PropertyName = "Model", PropertyValue = null, PropertyName_FR = AppResources.P_Model }, new ProductProperty(PropertyType.IsBoolean) { PropertyName = "After sale service", PropertyValue = null, ItemSource = ServiceSubCategoryModel, PropertyName_FR = AppResources.P_AfterSale }, new ProductProperty(PropertyType.IsPicker) { PropertyName = "Service category", PropertyValue = null, AllSource = ServiceModel, ItemSource = new List <string>() { "N.A" }, PropertyName_FR = AppResources.P_ServiceCategory }, new ProductProperty(PropertyType.IsLabel) { PropertyName = "Unit Price", PropertyValue = null, PropertyName_FR = AppResources.P_UnitPrice }, new ProductProperty(PropertyType.IsLabel) { PropertyName = "Reference", PropertyValue = null, PropertyName_FR = AppResources.P_Reference }, new ProductProperty(PropertyType.IsText) { PropertyName = "Seat size", PropertyValue = null, PropertyName_FR = AppResources.P_Seatsize }, new ProductProperty(PropertyType.IsText) { PropertyName = "Flap size", PropertyValue = null, PropertyName_FR = AppResources.P_Flapsize }, new ProductProperty(PropertyType.IsText) { PropertyName = "Leather", PropertyValue = null, PropertyName_FR = AppResources.P_Leather }, new ProductProperty(PropertyType.IsPicker) { PropertyName = "Color", PropertyValue = null, ItemSource = new List <string>() { "Light Brown", "Chocolate", "Black" }, PropertyName_FR = AppResources.P_Color }, new ProductProperty(PropertyType.IsText) { PropertyName = "Category", PropertyValue = null, PropertyName_FR = AppResources.P_Category }, new ProductProperty(PropertyType.IsText) { PropertyName = "Comments", PropertyValue = null, PropertyName_FR = AppResources.P_Comments }, } }); Products.Add(new Product() { Description = "Other", Name = "Other", Name_FR = AppResources.P_Other, ProductKind = ProductKind.other, Properties = new List <ProductProperty>() { new ProductProperty(PropertyType.IsText) { PropertyName = "Name", PropertyValue = null, PropertyName_FR = AppResources.Name }, new ProductProperty(PropertyType.IsText) { PropertyName = "Price", PropertyValue = null, IsNumberKeyboard = true, PropertyName_FR = AppResources.P_Price }, new ProductProperty(PropertyType.IsText) { PropertyName = "Description", PropertyValue = null, PropertyName_FR = AppResources.P_Description } } }); Products.Add(new Product() { Description = "TradeIn", Name = "TradeIn", Name_FR = AppResources.P_TradeIn, ProductKind = ProductKind.tradein, Properties = new List <ProductProperty>() { new ProductProperty(PropertyType.IsText) { PropertyName = "Serial number", PropertyValue = null, PropertyName_FR = AppResources.P_Serial_number }, new ProductProperty(PropertyType.IsText) { PropertyName = "Brand", PropertyValue = null, PropertyName_FR = AppResources.P_Brand }, new ProductProperty(PropertyType.IsText) { PropertyName = "Model", PropertyValue = null, PropertyName_FR = AppResources.P_Model }, new ProductProperty(PropertyType.IsText) { PropertyName = "Size", PropertyValue = null, PropertyName_FR = AppResources.P_Size }, new ProductProperty(PropertyType.IsText) { PropertyName = "Flap", PropertyValue = null, PropertyName_FR = AppResources.P_Flaps }, new ProductProperty(PropertyType.IsPicker) { PropertyName = "Color", PropertyValue = null, ItemSource = new List <string>() { "Light Brown", "Chocolate", "Black" }, PropertyName_FR = AppResources.P_Color }, new ProductProperty(PropertyType.IsText) { PropertyName = "Leather", PropertyValue = null, PropertyName_FR = AppResources.P_Leather }, new ProductProperty(PropertyType.IsBoolean) { PropertyName = "Blocks", PropertyValue = null, PropertyName_FR = AppResources.P_Blocks }, new ProductProperty(PropertyType.IsText) { PropertyName = "Other", PropertyValue = null, PropertyName_FR = AppResources.P_Other }, new ProductProperty(PropertyType.IsText) { PropertyName = "Amount", PropertyValue = null, IsNumberKeyboard = true, PropertyName_FR = AppResources.Amount }, new ProductProperty(PropertyType.IsText) { PropertyName = "Note", PropertyValue = null, PropertyName_FR = AppResources.P_Note }, } }); Products.Add(new Product() { Description = "Discount", Name = "Discount", Name_FR = AppResources.P_Discount, ProductKind = ProductKind.discount, Properties = new List <ProductProperty>() { new ProductProperty(PropertyType.IsText) { PropertyName = "Name", PropertyValue = null, PropertyName_FR = AppResources.Name }, new ProductProperty(PropertyType.IsText) { PropertyName = "Price", PropertyValue = null, IsNumberKeyboard = true, PropertyName_FR = AppResources.P_Price }, new ProductProperty(PropertyType.IsText) { PropertyName = "Note", PropertyValue = null, PropertyName_FR = AppResources.P_Note } } }); }