public ShoppeKeeperReferences(DataOvlReference dataOvlReference, NonPlayerCharacterReferences npcReferences) { _dataOvlReference = dataOvlReference; // we load a list of all shoppe keeper locations which we unfortunately had to map // ourselves because it appears most shoppe keeper data is in the code (OVL) files _shoppeKeepersByIndex = ShoppeKeeperReferences.LoadShoppeKeepersByIndex(_dataOvlReference); List <string> shoppeNames = dataOvlReference.GetDataChunk(DataOvlReference.DataChunkName.STORE_NAMES) .GetChunkAsStringList().Strs; List <string> shoppeKeeperNames = dataOvlReference .GetDataChunk(DataOvlReference.DataChunkName.SHOPPE_KEEPER_NAMES).GetChunkAsStringList().Strs; // Dammit Simplon, how the hell did you sneak into the Shoppe Keeper array!?! shoppeKeeperNames.Remove(@"Simplon"); Debug.Assert(shoppeNames.Count == shoppeKeeperNames.Count, "Must be same number of shoppe keepers to shoppes"); for (int i = 0; i < shoppeNames.Count; i++) { // create a new shoppe keeper object then add it to the list ShoppeKeeperReference shoppeKeeper = _shoppeKeepersByIndex[i];//new TheShoppeKeeperReference(); string shoppeKeeperName = shoppeKeeperNames[i]; shoppeKeeper.ShoppeName = shoppeNames[i]; shoppeKeeper.ShoppeKeeperName = shoppeKeeperName; List <NonPlayerCharacterReference> npcRefs = npcReferences.GetNonPlayerCharacterByLocationAndNPCType(shoppeKeeper.ShoppeKeeperLocation, shoppeKeeper.TheShoppeKeeperType); Debug.Assert(npcRefs.Count == 1); shoppeKeeper.NpcRef = npcRefs[0]; _shoppeKeepers.Add(shoppeKeeperName, shoppeKeeper); // we keep track of the location + type for easier world access to shoppe keeper reference if (!_shoppeKeepersByLocationAndType.ContainsKey(shoppeKeeper.ShoppeKeeperLocation)) { _shoppeKeepersByLocationAndType.Add(shoppeKeeper.ShoppeKeeperLocation, new Dictionary <NonPlayerCharacterReference.NPCDialogTypeEnum, ShoppeKeeperReference>()); } _shoppeKeepersByLocationAndType[shoppeKeeper.ShoppeKeeperLocation] .Add(shoppeKeeper.TheShoppeKeeperType, shoppeKeeper); // if it's a blacksmith then we load their items for sale if (shoppeKeeper.NpcRef.NPCType == NonPlayerCharacterReference.NPCDialogTypeEnum.Blacksmith) { shoppeKeeper.EquipmentForSaleList = GetEquipmentList(i); } } }
public MapCharacters(TileReferences tileRefs, NonPlayerCharacterReferences npcRefs, DataChunk animationStatesDataChunk, DataChunk overworldAnimationStatesDataChunk, DataChunk underworldAnimationStatesDataChunk, DataChunk charStatesDataChunk, DataChunk nonPlayerCharacterMovementLists, DataChunk nonPlayerCharacterMovementOffsets) { this._tileRefs = tileRefs; _smallMapAnimationStates = new MapCharacterAnimationStates(animationStatesDataChunk, tileRefs); _overworldAnimationState = new MapCharacterAnimationStates(overworldAnimationStatesDataChunk, tileRefs); _underworldAnimationState = new MapCharacterAnimationStates(underworldAnimationStatesDataChunk, tileRefs); _charStates = new MapCharacterStates(charStatesDataChunk, tileRefs); Movements = new NonPlayerCharacterMovements(nonPlayerCharacterMovementLists, nonPlayerCharacterMovementOffsets); this.NPCRefs = npcRefs; // we always load the over and underworld from disk immediatley, no need to reload as we will track it in memory // going forward _overworldAnimationState.Load(MapCharacterAnimationStates.MapCharacterAnimationStatesFiles.BRIT_OOL, true); _underworldAnimationState.Load(MapCharacterAnimationStates.MapCharacterAnimationStatesFiles.UNDER_OOL, true); }