public string GetLootJSON() { PR_PartionLoot <string, PartitionLoot <string> > looter; if (Config.LowerBound != 0 || Config.UpperBound != 1000) { List <string> allowedRars = new List <string>(); DefaultRarityTable.SharedInstance.Chain.Intervalls.Fuse(DefaultRarityTable.SharedInstance.Values).DoAction(r => { if (r.Item1.X >= Config.LowerBound && r.Item1.Y <= Config.UpperBound) { allowedRars.Add(r.Item2); } }); looter = new PR_PartionLoot <string, PartitionLoot <string> >(DefaultRarityTable.SharedInstance, PartitionLoot <string> .SharedInstance, allowedRars.ToArray()); } else { looter = new PR_PartionLoot <string, PartitionLoot <string> >(DefaultRarityTable.SharedInstance, PartitionLoot <string> .SharedInstance); } return(JsonConvert.SerializeObject( new LootWrapper() { LootItem = GetLoot( looter ).Item, Looter = looter }, Formatting.Indented )); }
public ItemWrapper GetConfiguredLoot() { ItemWrapper result; try { PR_PartionLoot <string, PartitionLoot <string> > looter = new PR_PartionLoot <string, PartitionLoot <string> >(DefaultRarityTable.SharedInstance, PartitionLoot <string> .SharedInstance); ILootable <string> item = GetLoot( looter, new ConfigurableFilter( _nameContains: config.Name, _typeContains: config.TypeContains, _rarityName: config.RarContains, _allowedRarities: config.AllowedRars, _allowedTypes: config.AllowedTypes, _rarityLowerBound: config.LowerRar, _rarityUpperBound: config.UpperRar ) ); result = new ItemWrapper() { Item = item.Item, Rarity = item.Rarity, RarName = item.RarityName, Name = item.Name, Type = item.Type, Probability = looter.LastProbability, AllItemNames = looter.InnerAlgorithm.LastItemNames, AllItemRarities = looter.InnerAlgorithm.LastItemRarities }; } catch (Exception) { result = new ItemWrapper() { ErrorFlag = true, Item = null, Rarity = 0, RarName = null, Name = null, Type = null, Probability = 0.0, AllItemNames = null, AllItemRarities = null, }; } return(result); }