private void BuildLootTable() { // Add entries for common types of objects _entries.Add(new LootEntry(LootType.Operations, GameObjectType.GenericPickup, "GET_OPS", Rarity.Common)); _entries.Add(new LootEntry(LootType.MaxOperations, GameObjectType.GenericPickup, "GET_MAXOPS", Rarity.Epic)); _entries.Add(new LootEntry(LootType.Stability, GameObjectType.GenericPickup, "GET_HP", Rarity.Common)); _entries.Add(new LootEntry(LootType.MaxStability, GameObjectType.GenericPickup, "GET_MAXHP", Rarity.Epic)); _entries.Add(new LootEntry(LootType.Experience, GameObjectType.GenericPickup, "BONUS_XP", Rarity.Common)); foreach (var command in CommandFactory.RegisteredCommands) { var entry = new LootEntry(LootType.Command, GameObjectType.CommandPickup, command.Id, command.Rarity, command.MinLevel) { Name = command.Name }; _entries.Add(entry); } }
private static bool LootAlreadyExists(GameContext context, LootEntry entry) { foreach (var cell in context.Level.Cells) { if (cell.Objects.OfType <CommandPickup>().Any(o => o.CommandId == entry.ObjectId)) { return(true); } } foreach (var instance in context.Player.Commands) { if (instance?.Command?.Id == entry.ObjectId) { return(true); } } return(false); }