/// <summary> /// Finds all NPCs at a certain location and certain type /// Best used for shoppe keepers /// </summary> /// <param name="location"></param> /// <param name="npcType"></param> /// <returns>NPC Reference</returns> public List <NonPlayerCharacterReference> GetNonPlayerCharacterByLocationAndNPCType( SmallMapReferences.SingleMapReference.Location location, NonPlayerCharacterReference.NPCDialogTypeEnum npcType) { List <NonPlayerCharacterReference> npcRefs = GetNonPlayerCharactersByLocation(location); return(npcRefs.Where(npcRef => npcRef.NPCType == npcType).ToList()); }
public ShoppeKeeperReference GetShoppeKeeperReference(SmallMapReferences.SingleMapReference.Location location, NonPlayerCharacterReference.NPCDialogTypeEnum npcType) { if (!_shoppeKeepersByLocationAndType.ContainsKey(location)) { throw new Ultima5ReduxException("You asked for " + location + " and it wasn't in the _shoppeKeepersByLocationAndType"); } if (!_shoppeKeepersByLocationAndType[location].ContainsKey(npcType)) { throw new Ultima5ReduxException("You asked for " + npcType + " in " + location + " and it wasn't in the _shoppeKeepersByLocationAndType"); } return(_shoppeKeepersByLocationAndType[location][npcType]); }
/// <summary> /// Gets a shoppekeeper based on location and NPC type /// </summary> /// <param name="location"></param> /// <param name="npcType"></param> /// <returns></returns> /// <exception cref="ArgumentOutOfRangeException">couldn't find the shoppe keeper at that particular location</exception> public ShoppeKeeper GetShoppeKeeper(SmallMapReferences.SingleMapReference.Location location, NonPlayerCharacterReference.NPCDialogTypeEnum npcType) { switch (npcType) { case NonPlayerCharacterReference.NPCDialogTypeEnum.Blacksmith: return(new BlackSmith(this, _inventory, _shoppeKeeperReferences.GetShoppeKeeperReference(location, npcType), _dataOvlReference)); case NonPlayerCharacterReference.NPCDialogTypeEnum.Barkeeper: break; case NonPlayerCharacterReference.NPCDialogTypeEnum.HorseSeller: break; case NonPlayerCharacterReference.NPCDialogTypeEnum.ShipSeller: break; case NonPlayerCharacterReference.NPCDialogTypeEnum.Healer: break; case NonPlayerCharacterReference.NPCDialogTypeEnum.InnKeeper: break; case NonPlayerCharacterReference.NPCDialogTypeEnum.MagicSeller: break; case NonPlayerCharacterReference.NPCDialogTypeEnum.GuildMaster: break; default: throw new ArgumentOutOfRangeException(nameof(npcType), npcType, null); } return(null); }