static public string GetEquipmentString(DataOvlReference dataOvlRef, int nString) { List <string> equipmentNames = dataOvlRef.GetDataChunk(DataOvlReference.DataChunkName.EQUIP_INDEXES).GetAsStringListFromIndexes(); if (nString == 0xFF) { return(" "); } return(equipmentNames[nString]); }
public Armours(DataOvlReference dataOvlRef, List <byte> gameStateByteArray) : base(dataOvlRef, gameStateByteArray) { equipmentNames = dataOvlRef.GetDataChunk(DataOvlReference.DataChunkName.EQUIP_INDEXES).GetAsStringListFromIndexes(); InitializeHelms(); //InitializeShields(); InitializeChestArmour(); InitializeAmulets(); InitializeRings(); }
static public 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]); }
static public 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]); }
static public 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]); }
public void InitializeLocationNames() { // get the data chunks that have the offsets to the strings in the data.ovl file, representing each location (most) DataChunk locationNameOffsetChunk = dataRef.GetDataChunk(DataOvlReference.DataChunkName.LOCATION_NAME_INDEXES); // get the offsets List <ushort> locationOffsets = locationNameOffsetChunk.GetChunkAsUINT16List(); locationNames = new List <string>(locationOffsets.Count + 1); // I happen to know that the underworld and overworld is [0], so let's add a placeholder locationNames.Add("Overworld/Underworld"); // grab each location string // it isn't the most efficient way, but it gets the job done foreach (ushort offset in locationOffsets) { locationNames.Add(dataRef.GetDataChunk(DataChunk.DataFormatType.SimpleString, string.Empty, offset, 20).GetChunkAsString().Replace("_", " ")); } }
public LargeMapReference(DataOvlReference dataRef, SmallMapReferences smallMapRef) { // 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); // Towns, Dwellings, Castles, Keeps, Dungeons //List<Point2D> vectors = new List<Point2D>(); for (int nVector = 0; nVector < 0x28; nVector++) { Point2D mapPoint = new Point2D(xLocs[nVector], yLocs[nVector]); SmallMapReferences.SingleMapReference.Location location = (SmallMapReferences.SingleMapReference.Location)nVector + 1; //vectors.Add(new Point2D(xLocs[nVector], yLocs[nVector])); // LocationXY.Add((SmallMapReferences.SingleMapReference.Location)nVector + 1, new Point2D(xLocs[nVector], yLocs[nVector])); LocationXY.Add(location, mapPoint); LocationXYLocations.Add(mapPoint, location); } }
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); }
/// <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); }
public U5StringRef(DataOvlReference dataRef) { this.dataRef = dataRef; strMap = new Dictionary <Type, SomeStrings>(); SomeStrings strs = dataRef.GetDataChunk(DataOvlReference.DataChunkName.TRAVEL).GetChunkAsStringList(); strMap.Add(typeof(DataOvlReference.CHUNK__PHRASES_CONVERSATION), dataRef.GetDataChunk(DataOvlReference.DataChunkName.PHRASES_CONVERSATION).GetChunkAsStringList()); strMap.Add(typeof(DataOvlReference.TRAVEL_STRINGS), dataRef.GetDataChunk(DataOvlReference.DataChunkName.TRAVEL).GetChunkAsStringList()); strMap.Add(typeof(DataOvlReference.LOCATION_STRINGS), dataRef.GetDataChunk(DataOvlReference.DataChunkName.LOCATION_NAMES).GetChunkAsStringList()); strMap.Add(typeof(DataOvlReference.WORLD_STRINGS), dataRef.GetDataChunk(DataOvlReference.DataChunkName.WORLD).GetChunkAsStringList()); strMap.Add(typeof(DataOvlReference.CHIT_CHAT_STRINGS), dataRef.GetDataChunk(DataOvlReference.DataChunkName.CHIT_CHAT).GetChunkAsStringList()); strMap.Add(typeof(DataOvlReference.KEYPRESS_COMMANDS_STRINGS), dataRef.GetDataChunk(DataOvlReference.DataChunkName.KEYPRESS_COMMANDS).GetChunkAsStringList()); strMap.Add(typeof(DataOvlReference.VISION1_STRINGS), dataRef.GetDataChunk(DataOvlReference.DataChunkName.VISION1).GetChunkAsStringList()); strMap.Add(typeof(DataOvlReference.VISION2_STRINGS), dataRef.GetDataChunk(DataOvlReference.DataChunkName.VISION2).GetChunkAsStringList()); strMap.Add(typeof(DataOvlReference.OPENING_THINGS_STRINGS), dataRef.GetDataChunk(DataOvlReference.DataChunkName.OPENING_THINGS_STUFF).GetChunkAsStringList()); strMap.Add(typeof(DataOvlReference.KLIMBING_STRINGS), dataRef.GetDataChunk(DataOvlReference.DataChunkName.KLIMBING).GetChunkAsStringList()); strMap.Add(typeof(DataOvlReference.GET_THINGS_STRINGS), dataRef.GetDataChunk(DataOvlReference.DataChunkName.GET_THINGS).GetChunkAsStringList()); strMap.Add(typeof(DataOvlReference.SPECIAL_ITEM_NAMES_STRINGS), dataRef.GetDataChunk(DataOvlReference.DataChunkName.SPECIAL_ITEM_NAMES).GetChunkAsStringList()); strMap.Add(typeof(DataOvlReference.WEAR_USE_ITEM_STRINGS), dataRef.GetDataChunk(DataOvlReference.DataChunkName.WEAR_USE_ITEM).GetChunkAsStringList()); strMap.Add(typeof(DataOvlReference.SHARDS_STRINGS), dataRef.GetDataChunk(DataOvlReference.DataChunkName.SHARDS).GetChunkAsStringList()); strMap.Add(typeof(DataOvlReference.SHADOWLORD_STRINGS), dataRef.GetDataChunk(DataOvlReference.DataChunkName.SHADOWLORD).GetChunkAsStringList()); strMap.Add(typeof(DataOvlReference.POTIONS_STRINGS), dataRef.GetDataChunk(DataOvlReference.DataChunkName.POTIONS).GetChunkAsStringList()); strMap.Add(typeof(DataOvlReference.SPELL_STRINGS), dataRef.GetDataChunk(DataOvlReference.DataChunkName.SPELLS).GetChunkAsStringList()); strMap.Add(typeof(DataOvlReference.SPECIAL_ITEM_NAMES2_STRINGS), dataRef.GetDataChunk(DataOvlReference.DataChunkName.SPECIAL_ITEM_NAMES2).GetChunkAsStringList()); strMap.Add(typeof(DataOvlReference.LONG_ARMOUR_STRING), dataRef.GetDataChunk(DataOvlReference.DataChunkName.LONG_ARMOUR).GetChunkAsStringList()); strMap.Add(typeof(DataOvlReference.SHORT_ARMOUR_STRING), dataRef.GetDataChunk(DataOvlReference.DataChunkName.SHORT_ARMOUR).GetChunkAsStringList()); strMap.Add(typeof(DataOvlReference.EQUIPPING_STRINGS), dataRef.GetDataChunk(DataOvlReference.DataChunkName.EQUIPPING).GetChunkAsStringList()); strMap.Add(typeof(DataOvlReference.ZSTATS_STRINGS), dataRef.GetDataChunk(DataOvlReference.DataChunkName.ZSTATS).GetChunkAsStringList()); strMap.Add(typeof(DataOvlReference.SLEEP_TRANSPORT_STRINGS), dataRef.GetDataChunk(DataOvlReference.DataChunkName.SLEEP_TRANSPORT).GetChunkAsStringList()); strMap.Add(typeof(DataOvlReference.REAGENT_STRINGS), dataRef.GetDataChunk(DataOvlReference.DataChunkName.REAGENTS).GetChunkAsStringList()); }