Example #1
0
 /// <summary>
 /// Construct a single map reference
 /// </summary>
 /// <param name="mapLocation">overall location (ie. Moonglow)</param>
 /// <param name="floor">the floor in the location (-1 basement, 0 main level, 1+ upstairs)</param>
 /// <param name="fileOffset">location of data offset in map file</param>
 public SingleMapReference(Location mapLocation, int floor, int fileOffset, DataOvlReference dataRef)
 {
     MapLocation = mapLocation;
     Floor       = floor;
     FileOffset  = fileOffset;
     DataRef     = dataRef;
 }
Example #2
0
        /// <summary>
        /// Blacksmith constructor
        /// </summary>
        /// <param name="shoppeKeeperDialogueReference"></param>
        /// <param name="inventory"></param>
        /// <param name="theShoppeKeeperReferences"></param>
        /// <param name="dataOvlReference"></param>
        public BlackSmith(ShoppeKeeperDialogueReference shoppeKeeperDialogueReference, Inventory inventory,
                          ShoppeKeeperReference theShoppeKeeperReferences, DataOvlReference dataOvlReference) : base(shoppeKeeperDialogueReference, theShoppeKeeperReferences, dataOvlReference)
        {
            _inventory = inventory;
            // go through each of the pieces of equipment in order to build a map of equipment index
            // -> merchant string list
            int nEquipmentCounter = 0;

            foreach (DataOvlReference.Equipment equipment in Enum.GetValues((typeof(DataOvlReference.Equipment))))
            {
                // we only look at equipment up to SpikedCollars
                if ((int)equipment > (int)DataOvlReference.Equipment.SpikedCollar)
                {
                    continue;
                }

                const int nEquipmentOffset = 8;

                CombatItem item = inventory.GetItemFromEquipment(equipment);
                if (item.BasePrice <= 0)
                {
                    continue;
                }
                // add an equipment offset because equipment strings don't start at zero in the merchant strings
                _equipmentMapToMerchantStrings.Add((int)equipment, nEquipmentCounter + nEquipmentOffset);
                nEquipmentCounter++;
            }
        }
Example #3
0
        /// <summary>
        /// Build the talk scripts
        /// </summary>
        /// <param name="u5Directory">Directory with Ultima 5 data files</param>
        /// <param name="dataRef">DataOVL Reference provides compressed word details</param>
        public TalkScripts(string u5Directory, DataOvlReference dataRef)
        {
            // save the compressed words, we're gonna need them
            this._compressedWordRef = new CompressedWordReference(dataRef);

            // just a lazy array that is easier to enumerate than the enum
            SmallMapReferences.SingleMapReference.SmallMapMasterFiles[] smallMapRefs =
            {
                SmallMapReferences.SingleMapReference.SmallMapMasterFiles.Castle,
                SmallMapReferences.SingleMapReference.SmallMapMasterFiles.Towne,
                SmallMapReferences.SingleMapReference.SmallMapMasterFiles.Keep,
                SmallMapReferences.SingleMapReference.SmallMapMasterFiles.Dwelling
            };

            // for each of the maps we are going to initialize
            foreach (SmallMapReferences.SingleMapReference.SmallMapMasterFiles mapRef in smallMapRefs)
            {
                // initialize the raw component of the talk scripts
                InitializeTalkScriptsRaw(u5Directory, mapRef);

                // initialize and allocate the appropriately sized list of TalkScript(s)
                _talkScriptRefs.Add(mapRef, new Dictionary <int, TalkScript>(_talkRefs[mapRef].Count));

                // for each of the NPCs in the particular map, initialize the individual NPC talk script
                foreach (int key in _talkRefs[mapRef].Keys)
                {
                    _talkScriptRefs[mapRef][key] = InitializeTalkScriptFromRaw(mapRef, key);
                    if (_bIsDebug)
                    {
                        Console.WriteLine(@"TalkScript in " + mapRef.ToString() + @" with #" + key.ToString());
                    }
                }
            }
        }
Example #4
0
 /// <summary>
 /// Construction a conversation
 /// </summary>
 /// <param name="npc">NPC you will have a conversation with</param>
 /// <param name="state">The games current State</param>
 /// <param name="dataOvlRef">Data.OVL for reference</param>
 public Conversation(NonPlayerCharacterReference npc, GameState state, DataOvlReference dataOvlRef)
 {
     this.Npc           = npc;
     _script            = npc.Script;
     this._gameStateRef = state;
     this._dataOvlRef   = dataOvlRef;
 }
Example #5
0
        /// <summary>
        /// Construct all small map references
        /// </summary>
        public SmallMapReferences(DataOvlReference dataRef)
        {
            // I wish I could do this a smarter way, but as of now I have no idea where this data is stored in any of the data files

            this._dataRef = dataRef;

            InitializeLocationNames();

            // Castle.dat
            AddLocation(SingleMapReference.Location.Lord_Britishs_Castle, true, 5);
            AddLocation(SingleMapReference.Location.Palace_of_Blackthorn, true, 5);
            AddLocation(SingleMapReference.Location.West_Britanny, false, 1);
            AddLocation(SingleMapReference.Location.North_Britanny, false, 1);
            AddLocation(SingleMapReference.Location.East_Britanny, false, 1);
            AddLocation(SingleMapReference.Location.Paws, false, 1);
            AddLocation(SingleMapReference.Location.Cove, false, 1);
            AddLocation(SingleMapReference.Location.Buccaneers_Den, false, 1);

            // Towne.dat
            AddLocation(SingleMapReference.Location.Moonglow, false, 2);
            AddLocation(SingleMapReference.Location.Britain, false, 2);
            AddLocation(SingleMapReference.Location.Jhelom, false, 2);
            AddLocation(SingleMapReference.Location.Yew, true, 2);
            AddLocation(SingleMapReference.Location.Minoc, false, 2);
            AddLocation(SingleMapReference.Location.Trinsic, false, 2);
            AddLocation(SingleMapReference.Location.Skara_Brae, false, 2);
            AddLocation(SingleMapReference.Location.New_Magincia, false, 2);

            // Dwelling.dat
            AddLocation(SingleMapReference.Location.Fogsbane, false, 3);
            AddLocation(SingleMapReference.Location.Stormcrow, false, 3);
            AddLocation(SingleMapReference.Location.Greyhaven, false, 3);
            AddLocation(SingleMapReference.Location.Waveguide, false, 3);
            AddLocation(SingleMapReference.Location.Iolos_Hut, false, 1);
            AddLocation(SingleMapReference.Location.Suteks_Hut, false, 1);
            AddLocation(SingleMapReference.Location.SinVraals_Hut, false, 1);
            AddLocation(SingleMapReference.Location.Grendels_Hut, false, 1);

            // Keep.dat
            AddLocation(SingleMapReference.Location.Ararat, false, 2);
            AddLocation(SingleMapReference.Location.Bordermarch, false, 2);
            AddLocation(SingleMapReference.Location.Farthing, false, 1);
            AddLocation(SingleMapReference.Location.Windemere, false, 1);
            AddLocation(SingleMapReference.Location.Stonegate, false, 1);
            AddLocation(SingleMapReference.Location.Lycaeum, false, 3);
            AddLocation(SingleMapReference.Location.Empath_Abbey, false, 3);
            AddLocation(SingleMapReference.Location.Serpents_Hold, true, 3);

            AddLocation(SingleMapReference.Location.Deceit, false, 0);
            AddLocation(SingleMapReference.Location.Despise, false, 0);
            AddLocation(SingleMapReference.Location.Destard, false, 0);
            AddLocation(SingleMapReference.Location.Wrong, false, 0);
            AddLocation(SingleMapReference.Location.Covetous, false, 0);
            AddLocation(SingleMapReference.Location.Shame, false, 0);
            AddLocation(SingleMapReference.Location.Hythloth, false, 0);
            AddLocation(SingleMapReference.Location.Doom, false, 0);
        }
Example #6
0
        public Spells(DataOvlReference dataOvlRef, List <byte> gameStateByteArray) : base(dataOvlRef, gameStateByteArray)
        {
            int nIndex = 0;

            foreach (Spell.SpellWords spell in Enum.GetValues(typeof(Spell.SpellWords)))
            {
                AddSpell(spell, (DataOvlReference.SpellStrings)nIndex++);
            }
        }
Example #7
0
        public Reagents(DataOvlReference dataOvlRef, List <byte> gameStateByteArray) : base(dataOvlRef, gameStateByteArray)
        {
            int nIndex = 0;

            foreach (Reagent.ReagentTypeEnum reagent in Enum.GetValues(typeof(Reagent.ReagentTypeEnum)))
            {
                AddReagent(reagent, (DataOvlReference.ReagentStrings)nIndex++);
            }
        }
Example #8
0
        //public CombatItem(int quantity, string longName, string shortName, int nSpriteNum, int attackStat, int defendStat, DataOvlReference.EQUIPMENT specificEquipment)
        //    : base(quantity, longName, shortName, nSpriteNum)
        //{
        //    attackStat = AttackStat;
        //    defendStat = DefendStat;
        //    this.SpecificEquipment = specificEquipment;
        //}
        //    ChestArmours.Add(new ChestArmour(chestArmour, gameStateByteArray[(int)chestArmour],
        //equipmentNames[(int)equipment], equipmentNames[(int)equipment],
        //       CombatItem.GetAttack(dataOvlRef, (int) equipment),
        //       CombatItem.GetDefense(dataOvlRef, (int) equipment),equipment));

        // CombatItem.GetAttack(dataOvlRef, (int)specificEquipment), CombatItem.GetDefense(dataOvlRef, (int)specificEquipment)
        protected CombatItem(DataOvlReference.Equipment specificEquipment, DataOvlReference dataOvlRef, IReadOnlyList <byte> gameStateRef, int nOffset, int nSpriteNum)
            : base(gameStateRef[nOffset], CombatItem.GetEquipmentString(dataOvlRef, (int)specificEquipment),
                   CombatItem.GetEquipmentString(dataOvlRef, (int)specificEquipment), nSpriteNum)
        {
            AttackStat             = GetAttack(dataOvlRef, (int)specificEquipment);
            DefendStat             = GetDefense(dataOvlRef, (int)specificEquipment);
            RequiredStrength       = GetRequiredStrength(dataOvlRef, (int)specificEquipment);
            this.SpecificEquipment = specificEquipment;
            InitializePrices(dataOvlRef);
        }
Example #9
0
        public static int GetRequiredStrength(DataOvlReference dataOvlRef, int nIndex)
        {
            List <byte> requiredStrengthValueList = dataOvlRef.GetDataChunk(DataOvlReference.DataChunkName.REQ_STRENGTH_EQUIP).GetAsByteList();

            if (nIndex >= requiredStrengthValueList.Count)
            {
                return(0);
            }
            return(requiredStrengthValueList[nIndex]);
        }
Example #10
0
        public static int GetDefense(DataOvlReference dataOvlRef, int nIndex)
        {
            List <byte> defenseValueList = dataOvlRef.GetDataChunk(DataOvlReference.DataChunkName.DEFENSE_VALUES).GetAsByteList();

            if (nIndex >= defenseValueList.Count)
            {
                return(0);
            }
            return(defenseValueList[nIndex]);
        }
Example #11
0
        public static int GetAttack(DataOvlReference dataOvlRef, int nIndex)
        {
            List <byte> attackValueList = dataOvlRef.GetDataChunk(DataOvlReference.DataChunkName.ATTACK_VALUES).GetAsByteList();

            if (nIndex >= attackValueList.Count)
            {
                return(0);
            }
            return(attackValueList[nIndex]);
        }
Example #12
0
        public Armours(DataOvlReference dataOvlRef, List <byte> gameStateByteArray) : base(dataOvlRef, gameStateByteArray)
        {
            _equipmentNames = dataOvlRef.GetDataChunk(DataOvlReference.DataChunkName.EQUIP_INDEXES).GetAsStringListFromIndexes();

            InitializeHelms();
            //InitializeShields();
            InitializeChestArmour();
            InitializeAmulets();
            InitializeRings();
        }
Example #13
0
 public Scrolls(DataOvlReference dataOvlRef, List <byte> gameStateByteArray) : base(dataOvlRef, gameStateByteArray)
 {
     AddScroll(Spell.SpellWords.Vas_Lor, DataOvlReference.SpellStrings.VAS_LOR);
     AddScroll(Spell.SpellWords.Rel_Hur, DataOvlReference.SpellStrings.REL_HUR);
     AddScroll(Spell.SpellWords.In_Sanct, DataOvlReference.SpellStrings.IN_SANCT);
     AddScroll(Spell.SpellWords.In_An, DataOvlReference.SpellStrings.IN_AN);
     AddScroll(Spell.SpellWords.In_Quas_Wis, DataOvlReference.SpellStrings.IN_QUAS_WIS);
     AddScroll(Spell.SpellWords.Kal_Xen_Corp, DataOvlReference.SpellStrings.KAL_XEN_CORP);
     AddScroll(Spell.SpellWords.In_Mani_Corp, DataOvlReference.SpellStrings.IN_MANI_CORP);
     AddScroll(Spell.SpellWords.An_Tym, DataOvlReference.SpellStrings.AN_TYM);
 }
Example #14
0
 public Potions(DataOvlReference dataOvlRef, List <byte> gameStateByteArray) : base(dataOvlRef, gameStateByteArray)
 {
     AddPotion(Potion.PotionColor.Blue, DataOvlReference.PotionsStrings.BLUE);
     AddPotion(Potion.PotionColor.Yellow, DataOvlReference.PotionsStrings.YELLOW);
     AddPotion(Potion.PotionColor.Red, DataOvlReference.PotionsStrings.RED);
     AddPotion(Potion.PotionColor.Green, DataOvlReference.PotionsStrings.GREEN);
     AddPotion(Potion.PotionColor.Orange, DataOvlReference.PotionsStrings.ORANGE);
     AddPotion(Potion.PotionColor.Purple, DataOvlReference.PotionsStrings.PURPLE);
     AddPotion(Potion.PotionColor.Black, DataOvlReference.PotionsStrings.BLACK);
     AddPotion(Potion.PotionColor.White, DataOvlReference.PotionsStrings.WHITE);
 }
Example #15
0
        /// <summary>
        /// Decompresses the strings and fills in each compressed word
        /// </summary>
        /// <param name="dataOvlReference"></param>
        private void BuildConversationTable(DataOvlReference dataOvlReference)
        {
            IEnumerable <string>    rawShoppeStrings        = _dataChunks.GetDataChunk(ShoppeKeeperChunkNames.AllData).GetChunkAsStringList().Strs;
            CompressedWordReference compressedWordReference = new CompressedWordReference(dataOvlReference);
            int i = 0;

            foreach (string rawShoppeString in rawShoppeStrings)
            {
                string convertedStr = compressedWordReference.ReplaceRawMerchantStringsWithCompressedWords(rawShoppeString);
                Console.WriteLine((i++) + @"," + @"""" + convertedStr.Replace('\n', '_').Replace('"', '+') + @"""");
                _merchantStrings.Add(convertedStr);
            }
        }
Example #16
0
 public LordBritishArtifacts(DataOvlReference dataOvlRef, List <byte> gameStateByteArray) : base(dataOvlRef, gameStateByteArray)
 {
     Items[LordBritishArtifact.ArtifactType.Amulet] = new LordBritishArtifact(LordBritishArtifact.ArtifactType.Amulet,
                                                                              gameStateByteArray[(int)Offsets.AMULET],
                                                                              dataOvlRef.StringReferences.GetString(DataOvlReference.SpecialItemNamesStrings.AMULET),
                                                                              dataOvlRef.StringReferences.GetString(DataOvlReference.WearUseItemStrings.WEARING_AMULET));
     Items[LordBritishArtifact.ArtifactType.Crown] = new LordBritishArtifact(LordBritishArtifact.ArtifactType.Crown,
                                                                             gameStateByteArray[(int)Offsets.CROWN],
                                                                             dataOvlRef.StringReferences.GetString(DataOvlReference.SpecialItemNamesStrings.CROWN),
                                                                             dataOvlRef.StringReferences.GetString(DataOvlReference.WearUseItemStrings.DON_THE_CROWN));
     Items[LordBritishArtifact.ArtifactType.Sceptre] = new LordBritishArtifact(LordBritishArtifact.ArtifactType.Sceptre,
                                                                               gameStateByteArray[(int)Offsets.SCEPTRE],
                                                                               dataOvlRef.StringReferences.GetString(DataOvlReference.SpecialItemNamesStrings.SCEPTRE),
                                                                               dataOvlRef.StringReferences.GetString(DataOvlReference.WearUseItemStrings.WIELD_SCEPTRE));
 }
Example #17
0
        /// <summary>
        /// Construct using the on disk references
        /// </summary>
        /// <param name="u5Directory"></param>
        /// <param name="dataOvlReference"></param>
        /// <param name="npcReferences"></param>
        public ShoppeKeeperDialogueReference(string u5Directory, DataOvlReference dataOvlReference, NonPlayerCharacterReferences npcReferences, Inventory inventory)
        {
            _dataOvlReference = dataOvlReference;
            string shoppeKeeperDataFilePath = Path.Combine(u5Directory, FileConstants.SHOPPE_DAT);

            _inventory = inventory;

            _dataChunks = new DataChunks <ShoppeKeeperChunkNames>(shoppeKeeperDataFilePath, ShoppeKeeperChunkNames.Unused);

            _dataChunks.AddDataChunk(DataChunk.DataFormatType.StringList, "All Shoppe Keeper Conversations", 0x00, 0x2797, 0, ShoppeKeeperChunkNames.AllData);

            BuildConversationTable(dataOvlReference);

            _shoppeKeeperReferences = new ShoppeKeeperReferences(dataOvlReference, npcReferences);
        }
Example #18
0
        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);
                }
            }
        }
Example #19
0
        /// <summary>
        /// Constructor building xy table
        /// </summary>
        /// <param name="dataRef">data ovl reference for extracting xy coordinates</param>
        public LargeMapLocationReferences(DataOvlReference dataRef)
        {
            // Load the location XYs and map them against the location
            List <byte> xLocs = dataRef.GetDataChunk(DataOvlReference.DataChunkName.LOCATIONS_X).GetAsByteList();
            List <byte> yLocs = dataRef.GetDataChunk(DataOvlReference.DataChunkName.LOCATIONS_Y).GetAsByteList();

            Debug.Assert(xLocs.Count == yLocs.Count);

            for (int nVector = 0; nVector < N_TOTAL_LOCATIONS; nVector++)
            {
                Point2D mapPoint = new Point2D(xLocs[nVector], yLocs[nVector]);
                SmallMapReferences.SingleMapReference.Location location = (SmallMapReferences.SingleMapReference.Location)nVector + 1;
                LocationXY.Add(location, mapPoint);
                LocationXYLocations.Add(mapPoint, location);
            }
        }
Example #20
0
 public ShadowlordShards(DataOvlReference dataOvlRef, List <byte> gameStateByteArray) : base(dataOvlRef, gameStateByteArray)
 {
     Items[ShadowlordShard.ShardType.Falsehood] = new ShadowlordShard(ShadowlordShard.ShardType.Falsehood,
                                                                      gameStateByteArray[(int)Offsets.FALSEHOOD],
                                                                      dataOvlRef.StringReferences.GetString(DataOvlReference.ShardsStrings.FALSEHOOD),
                                                                      dataOvlRef.StringReferences.GetString(DataOvlReference.ShadowlordStrings.GEM_SHARD_THOU_HOLD_EVIL_SHARD) +
                                                                      dataOvlRef.StringReferences.GetString(DataOvlReference.ShadowlordStrings.FALSEHOOD_DOT));
     Items[ShadowlordShard.ShardType.Hatred] = new ShadowlordShard(ShadowlordShard.ShardType.Hatred,
                                                                   gameStateByteArray[(int)Offsets.HATRED],
                                                                   dataOvlRef.StringReferences.GetString(DataOvlReference.ShardsStrings.HATRED),
                                                                   dataOvlRef.StringReferences.GetString(DataOvlReference.ShadowlordStrings.GEM_SHARD_THOU_HOLD_EVIL_SHARD) +
                                                                   dataOvlRef.StringReferences.GetString(DataOvlReference.ShadowlordStrings.HATRED_DOT));
     Items[ShadowlordShard.ShardType.Cowardice] = new ShadowlordShard(ShadowlordShard.ShardType.Cowardice,
                                                                      gameStateByteArray[(int)Offsets.COWARDICE],
                                                                      dataOvlRef.StringReferences.GetString(DataOvlReference.ShardsStrings.COWARDICE),
                                                                      dataOvlRef.StringReferences.GetString(DataOvlReference.ShadowlordStrings.GEM_SHARD_THOU_HOLD_EVIL_SHARD) +
                                                                      dataOvlRef.StringReferences.GetString(DataOvlReference.ShadowlordStrings.COWARDICE_DOT));
 }
Example #21
0
        public Moonstones(DataOvlReference dataOvlRef, MoonPhaseReferences moonPhaseReferences, Moongates moongates)
            : base(dataOvlRef, null)
        {
            _moongates           = moongates;
            _moonPhaseReferences = moonPhaseReferences;

            // go through each of the moon phases one by one and create a moonstone
            foreach (MoonPhaseReferences.MoonPhases phase in Enum.GetValues(typeof(MoonPhaseReferences.MoonPhases)))
            {
                // there is no "no moon" moonstone
                if (phase == MoonPhaseReferences.MoonPhases.NoMoon)
                {
                    continue;
                }
                Items[phase] = new Moonstone(phase,
                                             dataOvlRef.StringReferences.GetString(DataOvlReference.ZstatsStrings.MOONSTONE_SPACE).TrimEnd(),
                                             dataOvlRef.StringReferences.GetString(DataOvlReference.ZstatsStrings.MOONSTONE_SPACE).TrimEnd(),
                                             dataOvlRef.StringReferences.GetString(DataOvlReference.ThingsIFindStrings.A_STRANGE_ROCK_BANG_N)
                                             .TrimEnd(), moongates, null);
                //invRefs.GetInventoryReference(InventoryReferences.InventoryReferenceType.Item, phase.ToString()));
            }
        }
Example #22
0
        /// <summary>
        /// Construct a compressed word reference using the Data.OVL reference
        /// </summary>
        /// <param name="dataRef"></param>
        public CompressedWordReference(DataOvlReference dataRef)
        {
            _compressedWords = dataRef.GetDataChunk(DataOvlReference.DataChunkName.TALK_COMPRESSED_WORDS).GetChunkAsStringList();
            _compressedWords.PrintSomeStrings();

            // we are creating a lookup map because the indexes are not concurrent
            _compressWordLookupMap = new Dictionary <int, byte>(_compressedWords.Strs.Count);

            // this is kind of gross, but these define the index gaps in the lookup table
            // I have no idea why there are gaps, but alas, this works around them
            int i = 0;

            AddByteLookupMapping(1, 7, --i);
            AddByteLookupMapping(9, 27, --i);
            AddByteLookupMapping(29, 49, --i);
            AddByteLookupMapping(51, 64, --i);
            AddByteLookupMapping(66, 66, --i);
            AddByteLookupMapping(68, 69, --i);
            AddByteLookupMapping(71, 71, --i);
            i -= 4;
            AddByteLookupMapping(76, 129, i);
        }
Example #23
0
        public Weapons(DataOvlReference dataOvlRef, List <byte> gameStateByteArray) : base(dataOvlRef, gameStateByteArray)
        {
            _equipmentNames = dataOvlRef.GetDataChunk(DataOvlReference.DataChunkName.EQUIP_INDEXES).GetAsStringListFromIndexes();

            // we need to actually add shields because they can be equipped as weapons
            // but you should not expose shields twice in the UI
            AddWeapon(Weapon.WeaponTypeEnum.SmallShield, Weapon.WeaponTypeSpriteEnum.SmallShield, DataOvlReference.Equipment.SmallShield);
            AddWeapon(Weapon.WeaponTypeEnum.LargeShield, Weapon.WeaponTypeSpriteEnum.LargeShield, DataOvlReference.Equipment.LargeShield);
            AddWeapon(Weapon.WeaponTypeEnum.SpikedShield, Weapon.WeaponTypeSpriteEnum.SpikedShield, DataOvlReference.Equipment.SpikedShield);
            AddWeapon(Weapon.WeaponTypeEnum.MagicShield, Weapon.WeaponTypeSpriteEnum.MagicShield, DataOvlReference.Equipment.MagicShield);
            AddWeapon(Weapon.WeaponTypeEnum.JewelShield, Weapon.WeaponTypeSpriteEnum.JewelShield, DataOvlReference.Equipment.JewelShield);

            AddWeapon(Weapon.WeaponTypeEnum.Dagger, Weapon.WeaponTypeSpriteEnum.Dagger, DataOvlReference.Equipment.Dagger);
            AddWeapon(Weapon.WeaponTypeEnum.Sling, Weapon.WeaponTypeSpriteEnum.Sling, DataOvlReference.Equipment.Sling);
            AddWeapon(Weapon.WeaponTypeEnum.Club, Weapon.WeaponTypeSpriteEnum.Club, DataOvlReference.Equipment.Club);
            AddWeapon(Weapon.WeaponTypeEnum.FlamingOil, Weapon.WeaponTypeSpriteEnum.FlamingOil, DataOvlReference.Equipment.FlamingOil);
            AddWeapon(Weapon.WeaponTypeEnum.MainGauche, Weapon.WeaponTypeSpriteEnum.MainGauche, DataOvlReference.Equipment.MainGauche);
            AddWeapon(Weapon.WeaponTypeEnum.Spear, Weapon.WeaponTypeSpriteEnum.Spear, DataOvlReference.Equipment.Spear);
            AddWeapon(Weapon.WeaponTypeEnum.ThrowingAxe, Weapon.WeaponTypeSpriteEnum.ThrowingAxe, DataOvlReference.Equipment.ThrowingAxe);
            AddWeapon(Weapon.WeaponTypeEnum.ShortSword, Weapon.WeaponTypeSpriteEnum.ShortSword, DataOvlReference.Equipment.ShortSword);
            AddWeapon(Weapon.WeaponTypeEnum.Mace, Weapon.WeaponTypeSpriteEnum.Mace, DataOvlReference.Equipment.Mace);
            AddWeapon(Weapon.WeaponTypeEnum.MorningStar, Weapon.WeaponTypeSpriteEnum.MorningStar, DataOvlReference.Equipment.MorningStar);
            AddWeapon(Weapon.WeaponTypeEnum.Bow, Weapon.WeaponTypeSpriteEnum.Bow, DataOvlReference.Equipment.Bow);
            AddWeapon(Weapon.WeaponTypeEnum.Arrows, Weapon.WeaponTypeSpriteEnum.Arrows, DataOvlReference.Equipment.Arrows);
            AddWeapon(Weapon.WeaponTypeEnum.Crossbow, Weapon.WeaponTypeSpriteEnum.Crossbow, DataOvlReference.Equipment.Crossbow);
            AddWeapon(Weapon.WeaponTypeEnum.Quarrels, Weapon.WeaponTypeSpriteEnum.Quarrels, DataOvlReference.Equipment.Quarrels);
            AddWeapon(Weapon.WeaponTypeEnum.LongSword, Weapon.WeaponTypeSpriteEnum.LongSword, DataOvlReference.Equipment.LongSword);
            AddWeapon(Weapon.WeaponTypeEnum.TwoHHammer, Weapon.WeaponTypeSpriteEnum.TwoHHammer, DataOvlReference.Equipment.TwoHHammer);
            AddWeapon(Weapon.WeaponTypeEnum.TwoHAxe, Weapon.WeaponTypeSpriteEnum.TwoHAxe, DataOvlReference.Equipment.TwoHAxe);
            AddWeapon(Weapon.WeaponTypeEnum.TwoHSword, Weapon.WeaponTypeSpriteEnum.TwoHSword, DataOvlReference.Equipment.TwoHSword);
            AddWeapon(Weapon.WeaponTypeEnum.Halberd, Weapon.WeaponTypeSpriteEnum.Halberd, DataOvlReference.Equipment.Halberd);
            AddWeapon(Weapon.WeaponTypeEnum.SwordofChaos, Weapon.WeaponTypeSpriteEnum.SwordofChaos, DataOvlReference.Equipment.SwordofChaos);
            AddWeapon(Weapon.WeaponTypeEnum.MagicBow, Weapon.WeaponTypeSpriteEnum.MagicBow, DataOvlReference.Equipment.MagicBow);
            AddWeapon(Weapon.WeaponTypeEnum.SilverSword, Weapon.WeaponTypeSpriteEnum.SilverSword, DataOvlReference.Equipment.SilverSword);
            AddWeapon(Weapon.WeaponTypeEnum.MagicAxe, Weapon.WeaponTypeSpriteEnum.MagicAxe, DataOvlReference.Equipment.MagicAxe);
            AddWeapon(Weapon.WeaponTypeEnum.GlassSword, Weapon.WeaponTypeSpriteEnum.GlassSword, DataOvlReference.Equipment.GlassSword);
            AddWeapon(Weapon.WeaponTypeEnum.JeweledSword, Weapon.WeaponTypeSpriteEnum.JeweledSword, DataOvlReference.Equipment.JeweledSword);
            AddWeapon(Weapon.WeaponTypeEnum.MysticSword, Weapon.WeaponTypeSpriteEnum.MysticSword, DataOvlReference.Equipment.MysticSword);
        }
Example #24
0
 public SpecialItems(DataOvlReference dataOvlRef, List <byte> gameStateByteArray) : base(dataOvlRef, gameStateByteArray)
 {
     //   Carpet = 170, Grapple = 12, Spyglass = 89, HMSCape = 260, PocketWatch = 232, BlackBadge = 281,
     //WoodenBox = 270, Sextant = 256
     Items[SpecialItem.ItemTypeSpriteEnum.Carpet] = new SpecialItem(SpecialItem.ItemTypeSpriteEnum.Carpet,
                                                                    gameStateByteArray[(int)SpecialItem.ItemTypeEnum.Carpet],
                                                                    dataOvlRef.StringReferences.GetString(DataOvlReference.SpecialItemNamesStrings.MAGIC_CRPT),
                                                                    dataOvlRef.StringReferences.GetString(DataOvlReference.SpecialItemNamesStrings.MAGIC_CRPT));
     Items[SpecialItem.ItemTypeSpriteEnum.Grapple] = new SpecialItem(SpecialItem.ItemTypeSpriteEnum.Grapple,
                                                                     gameStateByteArray[(int)SpecialItem.ItemTypeEnum.Grapple],
                                                                     "Grappling Hook",
                                                                     "Grapple");
     Items[SpecialItem.ItemTypeSpriteEnum.Spyglass] = new SpecialItem(SpecialItem.ItemTypeSpriteEnum.Spyglass,
                                                                      gameStateByteArray[(int)SpecialItem.ItemTypeEnum.Spyglass],
                                                                      dataOvlRef.StringReferences.GetString(DataOvlReference.SpecialItemNames2Strings.SPYGLASS),
                                                                      dataOvlRef.StringReferences.GetString(DataOvlReference.SpecialItemNames2Strings.SPYGLASS));
     Items[SpecialItem.ItemTypeSpriteEnum.HMSCape] = new SpecialItem(SpecialItem.ItemTypeSpriteEnum.HMSCape,
                                                                     gameStateByteArray[(int)SpecialItem.ItemTypeEnum.HMSCape],
                                                                     dataOvlRef.StringReferences.GetString(DataOvlReference.SpecialItemNames2Strings.HMS_CAPE_PLAN),
                                                                     dataOvlRef.StringReferences.GetString(DataOvlReference.SpecialItemNames2Strings.HMS_CAPE_PLAN));
     Items[SpecialItem.ItemTypeSpriteEnum.Sextant] = new SpecialItem(SpecialItem.ItemTypeSpriteEnum.Sextant,
                                                                     gameStateByteArray[(int)SpecialItem.ItemTypeEnum.Sextant],
                                                                     dataOvlRef.StringReferences.GetString(DataOvlReference.SpecialItemNames2Strings.SEXTANT),
                                                                     dataOvlRef.StringReferences.GetString(DataOvlReference.SpecialItemNames2Strings.SEXTANT));
     Items[SpecialItem.ItemTypeSpriteEnum.PocketWatch] = new SpecialItem(SpecialItem.ItemTypeSpriteEnum.PocketWatch,
                                                                         //gameStateByteArray[(int)SpecialItem.ItemTypeEnum.PocketWatch],
                                                                         1,
                                                                         dataOvlRef.StringReferences.GetString(DataOvlReference.SpecialItemNames2Strings.POCKET_WATCH),
                                                                         dataOvlRef.StringReferences.GetString(DataOvlReference.SpecialItemNames2Strings.POCKET_WATCH));
     Items[SpecialItem.ItemTypeSpriteEnum.BlackBadge] = new SpecialItem(SpecialItem.ItemTypeSpriteEnum.BlackBadge,
                                                                        gameStateByteArray[(int)SpecialItem.ItemTypeEnum.BlackBadge],
                                                                        dataOvlRef.StringReferences.GetString(DataOvlReference.SpecialItemNames2Strings.BLACK_BADGE),
                                                                        dataOvlRef.StringReferences.GetString(DataOvlReference.SpecialItemNames2Strings.BLACK_BADGE));
     Items[SpecialItem.ItemTypeSpriteEnum.WoodenBox] = new SpecialItem(SpecialItem.ItemTypeSpriteEnum.WoodenBox,
                                                                       gameStateByteArray[(int)SpecialItem.ItemTypeEnum.WoodenBox],
                                                                       dataOvlRef.StringReferences.GetString(DataOvlReference.SpecialItemNames2Strings.WOODEN_BOX),
                                                                       dataOvlRef.StringReferences.GetString(DataOvlReference.SpecialItemNames2Strings.WOODEN_BOX));
 }
Example #25
0
        public U5StringRef(DataOvlReference dataRef)
        {
            this._dataRef = dataRef;
            _strMap       = new Dictionary <Type, SomeStrings>();
            //SomeStrings strs = dataRef.GetDataChunk(DataOvlReference.DataChunkName.TRAVEL).GetChunkAsStringList();

            _strMap.Add(typeof(DataOvlReference.ChunkPhrasesConversation), dataRef.GetDataChunk(DataOvlReference.DataChunkName.PHRASES_CONVERSATION).GetChunkAsStringList());
            _strMap.Add(typeof(DataOvlReference.TravelStrings), dataRef.GetDataChunk(DataOvlReference.DataChunkName.TRAVEL).GetChunkAsStringList());
            _strMap.Add(typeof(DataOvlReference.LocationStrings), dataRef.GetDataChunk(DataOvlReference.DataChunkName.LOCATION_NAMES).GetChunkAsStringList());
            _strMap.Add(typeof(DataOvlReference.WorldStrings), dataRef.GetDataChunk(DataOvlReference.DataChunkName.WORLD).GetChunkAsStringList());
            _strMap.Add(typeof(DataOvlReference.ChitChatStrings), dataRef.GetDataChunk(DataOvlReference.DataChunkName.CHIT_CHAT).GetChunkAsStringList());
            _strMap.Add(typeof(DataOvlReference.KeypressCommandsStrings), dataRef.GetDataChunk(DataOvlReference.DataChunkName.KEYPRESS_COMMANDS).GetChunkAsStringList());
            //_strMap.Add(typeof(DataOvlReference.Vision1Strings), dataRef.GetDataChunk(DataOvlReference.DataChunkName.VISION1).GetChunkAsStringList());
            _strMap.Add(typeof(DataOvlReference.Vision2Strings), dataRef.GetDataChunk(DataOvlReference.DataChunkName.VISION2).GetChunkAsStringList());
            _strMap.Add(typeof(DataOvlReference.OpeningThingsStrings), dataRef.GetDataChunk(DataOvlReference.DataChunkName.OPENING_THINGS_STUFF).GetChunkAsStringList());
            _strMap.Add(typeof(DataOvlReference.KlimbingStrings), dataRef.GetDataChunk(DataOvlReference.DataChunkName.KLIMBING).GetChunkAsStringList());
            _strMap.Add(typeof(DataOvlReference.GetThingsStrings), dataRef.GetDataChunk(DataOvlReference.DataChunkName.GET_THINGS).GetChunkAsStringList());
            _strMap.Add(typeof(DataOvlReference.SpecialItemNamesStrings), dataRef.GetDataChunk(DataOvlReference.DataChunkName.SPECIAL_ITEM_NAMES).GetChunkAsStringList());
            _strMap.Add(typeof(DataOvlReference.WearUseItemStrings), dataRef.GetDataChunk(DataOvlReference.DataChunkName.WEAR_USE_ITEM).GetChunkAsStringList());
            _strMap.Add(typeof(DataOvlReference.ShardsStrings), dataRef.GetDataChunk(DataOvlReference.DataChunkName.SHARDS).GetChunkAsStringList());
            _strMap.Add(typeof(DataOvlReference.ShadowlordStrings), dataRef.GetDataChunk(DataOvlReference.DataChunkName.WORDS_OF_POWER).GetChunkAsStringList());
            _strMap.Add(typeof(DataOvlReference.PotionsStrings), dataRef.GetDataChunk(DataOvlReference.DataChunkName.POTIONS).GetChunkAsStringList());
            _strMap.Add(typeof(DataOvlReference.SpellStrings), dataRef.GetDataChunk(DataOvlReference.DataChunkName.SPELLS).GetChunkAsStringList());
            _strMap.Add(typeof(DataOvlReference.SpecialItemNames2Strings), dataRef.GetDataChunk(DataOvlReference.DataChunkName.SPECIAL_ITEM_NAMES2).GetChunkAsStringList());
            _strMap.Add(typeof(DataOvlReference.LongArmourString), dataRef.GetDataChunk(DataOvlReference.DataChunkName.LONG_ARMOUR).GetChunkAsStringList());
            _strMap.Add(typeof(DataOvlReference.ShortArmourString), dataRef.GetDataChunk(DataOvlReference.DataChunkName.SHORT_ARMOUR).GetChunkAsStringList());
            _strMap.Add(typeof(DataOvlReference.EquippingStrings), dataRef.GetDataChunk(DataOvlReference.DataChunkName.EQUIPPING).GetChunkAsStringList());
            _strMap.Add(typeof(DataOvlReference.ZstatsStrings), dataRef.GetDataChunk(DataOvlReference.DataChunkName.ZSTATS).GetChunkAsStringList());
            _strMap.Add(typeof(DataOvlReference.SleepTransportStrings), dataRef.GetDataChunk(DataOvlReference.DataChunkName.SLEEP_TRANSPORT).GetChunkAsStringList());
            _strMap.Add(typeof(DataOvlReference.ReagentStrings), dataRef.GetDataChunk(DataOvlReference.DataChunkName.REAGENTS).GetChunkAsStringList());
            _strMap.Add(typeof(DataOvlReference.ExclaimStrings), dataRef.GetDataChunk(DataOvlReference.DataChunkName.EXCLAIMS).GetChunkAsStringList());
            _strMap.Add(typeof(DataOvlReference.ThingsIFindStrings), dataRef.GetDataChunk(DataOvlReference.DataChunkName.THINGS_I_FIND).GetChunkAsStringList());
            _strMap.Add(typeof(DataOvlReference.ShoppeKeeperSellingStrings), dataRef.GetDataChunk(DataOvlReference.DataChunkName.SHOPPE_KEEPER_SELLING).GetChunkAsStringList());
            _strMap.Add(typeof(DataOvlReference.ShoppeKeeperBlacksmithPositiveExclamation), dataRef.GetDataChunk(DataOvlReference.DataChunkName.SHOPPE_KEEPER_BLACKSMITH_POS_EXCLAIM).GetChunkAsStringList());
            _strMap.Add(typeof(DataOvlReference.ShoppeKeeperBlacksmithHello), dataRef.GetDataChunk(DataOvlReference.DataChunkName.SHOPPE_KEEPER_BLACKSMITH_HELLO).GetChunkAsStringList());
            _strMap.Add(typeof(DataOvlReference.ShoppeKeeperBlacksmithWeHave), dataRef.GetDataChunk(DataOvlReference.DataChunkName.SHOPPE_KEEPER_BLACKSMITH_WE_HAVE).GetChunkAsStringList());
        }
Example #26
0
 protected InventoryItems(DataOvlReference dataOvlRef, List <byte> gameStateByteArray)
 {
     this.DataOvlRef         = dataOvlRef;
     this.GameStateByteArray = gameStateByteArray;
 }
Example #27
0
 protected CombatItems(DataOvlReference dataOvlRef, List <byte> gameStateByteArray) : base(dataOvlRef, gameStateByteArray)
 {
 }
Example #28
0
 public Shield(ShieldTypeEnum shieldType, DataOvlReference.Equipment equipment, DataOvlReference dataOvlRef, List <byte> gameStateByteArray)
     : base(equipment, dataOvlRef, gameStateByteArray, (int)shieldType, SHIELD_SPRITE)
 {
     ShieldType = shieldType;
     //InitializePrices(dataOvlRef);
 }
Example #29
0
 public Amulet(AmuletEnum amuletType, DataOvlReference.Equipment equipment, DataOvlReference dataOvlRef, List <byte> gameStateByteArray)
     : base(equipment, dataOvlRef, gameStateByteArray, (int)amuletType, AMULET_SPRITE)
 {
     AmuletType = amuletType;
 }
Example #30
0
 public ChestArmour(ChestArmourEnum chestArmourType, DataOvlReference.Equipment equipment, DataOvlReference dataOvlRef, List <byte> gameStateByteArray)
     : base(equipment, dataOvlRef, gameStateByteArray, (int)chestArmourType, CHEST_ARMOUR_SPRITE)
 {
     ChestArmourType = chestArmourType;
 }