/// <summary> /// Update the observable collections /// </summary> public void UpdateInventoryCategories() { Treasures.Clear(); Gems.Clear(); ArmorSet.Clear(); Buffs.Clear(); foreach (var gameItemQuantity in _inventory) { if (gameItemQuantity.GameItem is Treasure) { Treasures.Add(gameItemQuantity); } if (gameItemQuantity.GameItem is Gem) { Gems.Add(gameItemQuantity); } if (gameItemQuantity.GameItem is ArmorSet) { ArmorSet.Add(gameItemQuantity); } if (gameItemQuantity.GameItem is Buff) { Buffs.Add(gameItemQuantity); } } }
internal override Event ReadEntry(BinaryReaderEx br) { EventType type = br.GetEnum32 <EventType>(br.Position + 0xC); switch (type) { case EventType.Treasure: return(Treasures.EchoAdd(new Event.Treasure(br))); case EventType.Generator: return(Generators.EchoAdd(new Event.Generator(br))); case EventType.ObjAct: return(ObjActs.EchoAdd(new Event.ObjAct(br))); case EventType.MapOffset: return(MapOffsets.EchoAdd(new Event.MapOffset(br))); case EventType.PseudoMultiplayer: return(PseudoMultiplayers.EchoAdd(new Event.PseudoMultiplayer(br))); case EventType.PatrolInfo: return(PatrolInfo.EchoAdd(new Event.PatrolInfo(br))); case EventType.PlatoonInfo: return(PlatoonInfo.EchoAdd(new Event.PlatoonInfo(br))); case EventType.Other: return(Others.EchoAdd(new Event.Other(br))); default: throw new NotImplementedException($"Unsupported event type: {type}"); } }
/// <summary> /// Update the observable collections /// </summary> public void UpdateInventoryCategories() { Soldiers.Clear(); SeigeWeapons.Clear(); Treasures.Clear(); Buffs.Clear(); foreach (var gameItemQuantity in _inventory) { if (gameItemQuantity.GameItem is Soldier) { Soldiers.Add(gameItemQuantity); } if (gameItemQuantity.GameItem is SeigeWeapon) { SeigeWeapons.Add(gameItemQuantity); } if (gameItemQuantity.GameItem is Treasure) { Treasures.Add(gameItemQuantity); } if (gameItemQuantity.GameItem is Buff) { Buffs.Add(gameItemQuantity); } } }
/// <summary> /// Adds an event to the appropriate list for its type; returns the event. /// </summary> public Event Add(Event evnt) { switch (evnt) { case Event.Light e: Lights.Add(e); break; case Event.Sound e: Sounds.Add(e); break; case Event.SFX e: SFX.Add(e); break; case Event.Wind e: Wind.Add(e); break; case Event.Treasure e: Treasures.Add(e); break; case Event.Generator e: Generators.Add(e); break; case Event.Message e: Messages.Add(e); break; case Event.ObjAct e: ObjActs.Add(e); break; case Event.SpawnPoint e: SpawnPoints.Add(e); break; case Event.MapOffset e: MapOffsets.Add(e); break; case Event.Navmesh e: Navmeshes.Add(e); break; case Event.Environment e: Environments.Add(e); break; case Event.PseudoMultiplayer e: PseudoMultiplayers.Add(e); break; default: throw new ArgumentException($"Unrecognized type {evnt.GetType()}.", nameof(evnt)); } return(evnt); }
/// <summary> /// Adds an event to the appropriate list for its type; returns the event. /// </summary> public Event Add(Event evnt) { switch (evnt) { case Event.Treasure e: Treasures.Add(e); break; case Event.Generator e: Generators.Add(e); break; case Event.ObjAct e: ObjActs.Add(e); break; case Event.MapOffset e: MapOffsets.Add(e); break; case Event.PseudoMultiplayer e: PseudoMultiplayers.Add(e); break; case Event.PatrolInfo e: PatrolInfo.Add(e); break; case Event.PlatoonInfo e: PlatoonInfo.Add(e); break; case Event.Other e: Others.Add(e); break; default: throw new ArgumentException($"Unrecognized type {evnt.GetType()}.", nameof(evnt)); } return(evnt); }
public static List <Treasures> LoadTreasures(string user) { List <Treasures> treasureList = new List <Treasures>(); StreamReader inputFile; inputFile = File.OpenText($"{Environment.CurrentDirectory}/save/{user}/{user}-Treasures.data"); int i = 0; while (!inputFile.EndOfStream) { string line = inputFile.ReadLine(); if (i != 0) { string[] words = line.Split(','); string id = words[0]; string name = words[1]; string desc = words[2]; string room = words[3]; Treasures loadedTreasures = Treasures.GetTreasures(id, name, desc, room); treasureList.Add(loadedTreasures); } i++; } return(treasureList); }
/// <summary> /// initialize the universe with all of the treasures /// </summary> private void IntializeUniverseTreasures() { Treasures.Add(new Treasure { Name = "Trantorian Ruby", TreasureType = Treasure.Type.Ruby, GameObjectID = 1, Description = "A deep red ruby the size of an egg.", SpaceTimeLocationID = 2, HasValue = true, Value = 25, CanAddToInventory = true }); Treasures.Add(new Treasure { Name = "Lodestone", TreasureType = Treasure.Type.Lodestone, GameObjectID = 2, Description = "A deep red ruby the size of an egg.", SpaceTimeLocationID = 3, HasValue = true, Value = 15, CanAddToInventory = true }); }
internal override Event ReadEntry(BinaryReaderEx br) { EventType type = br.GetEnum32 <EventType>(br.Position + 8); switch (type) { case EventType.Light: return(Lights.EchoAdd(new Event.Light(br))); case EventType.Sound: return(Sounds.EchoAdd(new Event.Sound(br))); case EventType.SFX: return(SFX.EchoAdd(new Event.SFX(br))); case EventType.Wind: return(Wind.EchoAdd(new Event.Wind(br))); case EventType.Treasure: return(Treasures.EchoAdd(new Event.Treasure(br))); case EventType.Generator: return(Generators.EchoAdd(new Event.Generator(br))); case EventType.Message: return(Messages.EchoAdd(new Event.Message(br))); default: throw new NotImplementedException($"Unsupported event type: {type}"); } }
public void UpdateInventoryCategories() { Potions.Clear(); Treasures.Clear(); Weapons.Clear(); Allies.Clear(); foreach (var GameItem in _inventory) { if (GameItem.GameItem is Potion) { Potions.Add(GameItem); } if (GameItem.GameItem is Treasure) { Treasures.Add(GameItem); } if (GameItem.GameItem is Weapon) { Weapons.Add(GameItem); } if (GameItem.GameItem is Allies) { Allies.Add(GameItem); } } }
public override string ToString() { var outputStringBuilder = new StringBuilder(); // Map coordinates outputStringBuilder.AppendLine($"C - { Width } - { Height }"); // Mountains coordinates foreach (var mountain in Mountains) { outputStringBuilder.AppendLine(mountain.ToString()); } // Treasures coordinates outputStringBuilder.AppendLine("# {T comme Trésor} - {Axe horizontal} - {Axe vertical} - {Nb. de trésors restants}"); foreach (var treasure in Treasures.Where(treasure => treasure.Count > 0)) { outputStringBuilder.AppendLine(treasure.ToString()); } // Adventurers coordinates outputStringBuilder.AppendLine("# {A comme Aventurier} - {Nom de l'aventurier} - {Axe horizontal} - {Axe vertical} - {Orientation} - {Nb. trésors ramassés}"); foreach (var adventurer in Adventurers) { outputStringBuilder.AppendLine(adventurer.ToString()); } return(outputStringBuilder.ToString()); }
public void RemoveTreasure(Position position) { var foundTreasure = Treasures.First(treasure => treasure.Position.Equals(position)); if (foundTreasure.Count > 1) { foundTreasure.Count--; } else { Treasures = Treasures.Where(treasure => !treasure.Equals(foundTreasure)); } }
/// <summary> /// initialize the kindom with all of the treasures /// </summary> private void IntializeKingdomTreasures() { Treasures.Add(new Treasure { Name = "Golden Bear Cloak", TreasureType = Treasure.Type.Armor, GameObjectID = 1, Description = "A tough cloak to keep you safe and warm", SwampLocationID = 2, HasValue = true, Value = 5000, CanAddToInventory = true }); Treasures.Add(new Treasure { Name = "Silver War Axe", TreasureType = Treasure.Type.Weapon, GameObjectID = 2, Description = "A large silver axe, capable of splitting a horse in two in one swing.", SwampLocationID = 3, HasValue = true, Value = 5000, CanAddToInventory = true }); Treasures.Add(new Treasure { Name = "Golden Marble", TreasureType = Treasure.Type.Weapon, GameObjectID = 3, Description = "A Marble of purest gold. Also hits with a solid thunk when thrown.", SwampLocationID = 3, HasValue = true, Value = 50, CanAddToInventory = true }); Treasures.Add(new Treasure { Name = "Iron Helmet", TreasureType = Treasure.Type.Armor, GameObjectID = 4, Description = "Sturdy Helmet to protect your thick noggin.", SwampLocationID = 1, HasValue = true, Value = 5000, CanAddToInventory = true }); }
internal override Event ReadEntry(BinaryReaderEx br) { EventType type = br.GetEnum32 <EventType>(br.Position + 8); switch (type) { case EventType.Light: return(Lights.EchoAdd(new Event.Light(br))); case EventType.Sound: return(Sounds.EchoAdd(new Event.Sound(br))); case EventType.SFX: return(SFX.EchoAdd(new Event.SFX(br))); case EventType.Wind: return(Wind.EchoAdd(new Event.Wind(br))); case EventType.Treasure: return(Treasures.EchoAdd(new Event.Treasure(br))); case EventType.Generator: return(Generators.EchoAdd(new Event.Generator(br))); case EventType.Message: return(Messages.EchoAdd(new Event.Message(br))); case EventType.ObjAct: return(ObjActs.EchoAdd(new Event.ObjAct(br))); case EventType.SpawnPoint: return(SpawnPoints.EchoAdd(new Event.SpawnPoint(br))); case EventType.MapOffset: return(MapOffsets.EchoAdd(new Event.MapOffset(br))); case EventType.Navmesh: return(Navmeshes.EchoAdd(new Event.Navmesh(br))); case EventType.Environment: return(Environments.EchoAdd(new Event.Environment(br))); case EventType.PseudoMultiplayer: return(PseudoMultiplayers.EchoAdd(new Event.PseudoMultiplayer(br))); default: throw new NotImplementedException($"Unsupported event type: {type}"); } }
public bool CollidesCharacterWithTreasure(MainCharacter character) { int pos = 0; bool collided = false; while (pos < Treasures.Count && !collided) { if (character.CollidesWith(Treasures[pos], XMap, YMap)) { collided = true; Treasures.RemoveAt(pos); } pos++; } return(collided); }
/// <summary> /// initialize the universe with all of the treasures /// </summary> private void IntializeUniverseTreasures() { Treasures.Add(new Treasure { Name = "Star of Elendil", TreasureType = Treasure.Type.Ruby, GameObjectID = 1, Description = "A jewel made of \"elvish crystal\" and " + "the chief symbol of the royal line of Arnor", SpaceTimeLocationID = 2, HasValue = true, Value = 150, CanAddToInventory = true }); Treasures.Add(new Treasure { Name = "Star of the Dúnedain", TreasureType = Treasure.Type.Lodestone, GameObjectID = 2, Description = "A silver brooch, shaped like a many-rayed star, worn by the Arnor-descended Rangers of the North.", SpaceTimeLocationID = 1, HasValue = true, Value = 75, CanAddToInventory = true }); Treasures.Add(new Treasure { Name = "Horn of Gondor", TreasureType = Treasure.Type.Lodestone, GameObjectID = 3, Description = "A large war-horn tipped with silver written in ancient characters. " + "Belonging to the kings son, someone would certainly be glad reward its return. ", SpaceTimeLocationID = 4, HasValue = true, Value = 150, CanAddToInventory = true }); }
/// <summary> /// Adds an event to the appropriate list for its type; returns the event. /// </summary> public Event Add(Event evnt) { switch (evnt) { case Event.Light e: Lights.Add(e); break; case Event.Sound e: Sounds.Add(e); break; case Event.SFX e: SFX.Add(e); break; case Event.Wind e: Wind.Add(e); break; case Event.Treasure e: Treasures.Add(e); break; case Event.Generator e: Generators.Add(e); break; case Event.Message e: Messages.Add(e); break; default: throw new ArgumentException($"Unrecognized type {evnt.GetType()}.", nameof(evnt)); } return(evnt); }
/// <summary> /// initialize the Castle with all of the treasures /// </summary> private void IntializeCastleTreasures() { Treasures.Add(new Treasure { Name = "Denari", TreasureType = Treasure.Coin.Denari, GameObjectID = 1, Description = Environment.NewLine + "\t" + "A small silver coin.", RoomID = 1, HasValue = true, Value = 25, CanAddToInventory = true }); Treasures.Add(new Treasure { Name = "Denari", TreasureType = Treasure.Coin.Denari, GameObjectID = 2, Description = Environment.NewLine + "\t" + "A small silver coin.", RoomID = 2, HasValue = true, Value = 25, CanAddToInventory = true }); Treasures.Add(new Treasure { Name = "Denari", TreasureType = Treasure.Coin.Denari, GameObjectID = 3, Description = Environment.NewLine + "\t" + "A small silver coin.", RoomID = 4, HasValue = true, Value = 25, CanAddToInventory = true }); Treasures.Add(new Treasure { Name = "Denari", TreasureType = Treasure.Coin.Denari, GameObjectID = 4, Description = Environment.NewLine + "\t" + "A small silver coin.", RoomID = 5, HasValue = true, Value = 25, CanAddToInventory = true }); Treasures.Add(new Treasure { Name = "Denari", TreasureType = Treasure.Coin.Denari, GameObjectID = 5, Description = Environment.NewLine + "\t" + "A small silver coin.", RoomID = 5, HasValue = true, Value = 25, CanAddToInventory = true }); Treasures.Add(new Treasure { Name = "Florin", TreasureType = Treasure.Coin.Florin, GameObjectID = 6, Description = Environment.NewLine + "\t" + "A gold coin decorated with a fleur-de-lis on one side and an image of St. John the Baptist on the other.", RoomID = 6, HasValue = true, Value = 100, CanAddToInventory = true }); Treasures.Add(new Treasure { Name = "Florin", TreasureType = Treasure.Coin.Florin, GameObjectID = 7, Description = Environment.NewLine + "\t" + "A gold coin decorated with a fleur-de-lis on one side and an image of St. John the Baptist on the other.", RoomID = 3, HasValue = true, Value = 100, CanAddToInventory = true }); Treasures.Add(new Treasure { Name = "Florin", TreasureType = Treasure.Coin.Florin, GameObjectID = 8, Description = Environment.NewLine + "\t" + "A gold coin decorated with a fleur-de-lis on one side and an image of St. John the Baptist on the other.", RoomID = -1, HasValue = true, Value = 100, CanAddToInventory = true }); Treasures.Add(new Treasure { Name = "Florin", TreasureType = Treasure.Coin.Florin, GameObjectID = 9, Description = Environment.NewLine + "\t" + "A gold coin decorated with a fleur-de-lis on one side and an image of St. John the Baptist on the other.", RoomID = -1, HasValue = true, Value = 100, CanAddToInventory = true }); Treasures.Add(new Treasure { Name = "Florin", TreasureType = Treasure.Coin.Florin, GameObjectID = 10, Description = Environment.NewLine + "\t" + "A gold coin decorated with a fleur-de-lis on one side and an image of St. John the Baptist on the other.", RoomID = -1, HasValue = true, Value = 100, CanAddToInventory = true }); Treasures.Add(new Treasure { Name = "Florin", TreasureType = Treasure.Coin.Florin, GameObjectID = 11, Description = Environment.NewLine + "\t" + "A gold coin decorated with a fleur-de-lis on one side and an image of St. John the Baptist on the other.", RoomID = -1, HasValue = true, Value = 100, CanAddToInventory = true }); Treasures.Add(new Treasure { Name = "Florin", TreasureType = Treasure.Coin.Florin, GameObjectID = 12, Description = Environment.NewLine + "\t" + "A gold coin decorated with a fleur-de-lis on one side and an image of St. John the Baptist on the other.", RoomID = -1, HasValue = true, Value = 100, CanAddToInventory = true }); Treasures.Add(new Treasure { Name = "Florin", TreasureType = Treasure.Coin.Florin, GameObjectID = 13, Description = Environment.NewLine + "\t" + "A gold coin decorated with a fleur-de-lis on one side and an image of St. John the Baptist on the other.", RoomID = -1, HasValue = true, Value = 100, CanAddToInventory = true }); Treasures.Add(new Treasure { Name = "Florin", TreasureType = Treasure.Coin.Florin, GameObjectID = 14, Description = Environment.NewLine + "\t" + "A gold coin decorated with a fleur-de-lis on one side and an image of St. John the Baptist on the other.", RoomID = -1, HasValue = true, Value = 100, CanAddToInventory = true }); Treasures.Add(new Treasure { Name = "Florin", TreasureType = Treasure.Coin.Florin, GameObjectID = 15, Description = Environment.NewLine + "\t" + "A gold coin decorated with a fleur-de-lis on one side and an image of St. John the Baptist on the other.", RoomID = -1, HasValue = true, Value = 100, CanAddToInventory = true }); }
internal override Event ReadEntry(BinaryReaderEx br) { EventType type = br.GetEnum32 <EventType>(br.Position + 0xC); switch (type) { case EventType.Treasure: var treasure = new Event.Treasure(br); Treasures.Add(treasure); return(treasure); case EventType.Generator: var generator = new Event.Generator(br); Generators.Add(generator); return(generator); case EventType.ObjAct: var objAct = new Event.ObjAct(br); ObjActs.Add(objAct); return(objAct); case EventType.MapOffset: var mapOffset = new Event.MapOffset(br); MapOffsets.Add(mapOffset); return(mapOffset); case EventType.WalkRoute: var walkRoute = new Event.WalkRoute(br); WalkRoutes.Add(walkRoute); return(walkRoute); case EventType.GroupTour: var groupTour = new Event.GroupTour(br); GroupTours.Add(groupTour); return(groupTour); case EventType.Event17: var event17 = new Event.Event17(br); Event17s.Add(event17); return(event17); case EventType.Event18: var event18 = new Event.Event18(br); Event18s.Add(event18); return(event18); case EventType.Event20: var event20 = new Event.Event20(br); Event20s.Add(event20); return(event20); case EventType.Event21: var event21 = new Event.Event21(br); Event21s.Add(event21); return(event21); case EventType.PartsGroup: var partsGroup = new Event.PartsGroup(br); PartsGroups.Add(partsGroup); return(partsGroup); case EventType.Event23: var event23 = new Event.Event23(br); Event23s.Add(event23); return(event23); case EventType.AutoDrawGroup: var autoDrawGroup = new Event.AutoDrawGroup(br); AutoDrawGroups.Add(autoDrawGroup); return(autoDrawGroup); case EventType.Other: var other = new Event.Other(br); Others.Add(other); return(other); default: throw new NotImplementedException($"Unimplemented model type: {type}"); } }
/// <summary> /// initialize the future with all of the treasures /// </summary> private void IntializeFutureTreasures() { Treasures.Add(new Treasure { Name = "Keys", TreasureType = Treasure.Type.Keys, GameObjectID = 1, Description = "Keys to the Delorean that can take you anywhere.", YearTimeLocationID = 2, HasValue = true, Value = 50, CanAddToInventory = true }); Treasures.Add(new Treasure { Name = "Cane", TreasureType = Treasure.Type.Cane, GameObjectID = 2, Description = "A gold crusted knuckle handle is at the tip of the cane.", YearTimeLocationID = 3, HasValue = false, Value = 15, CanAddToInventory = true }); Treasures.Add(new Treasure { Name = "Gold Coin", TreasureType = Treasure.Type.GoldCoin, GameObjectID = 3, Description = "This coin can pay for a lot in 1885.", YearTimeLocationID = 5, HasValue = true, Value = 35, CanAddToInventory = true }); Treasures.Add(new Treasure { Name = "Map", TreasureType = Treasure.Type.Map, GameObjectID = 4, Description = "This map has been around for centuries and is the only thing that will help navigate the future.", YearTimeLocationID = 1, HasValue = true, Value = 100, CanAddToInventory = false }); Treasures.Add(new Treasure { Name = "Phone Book", TreasureType = Treasure.Type.PhoneBook, GameObjectID = 5, Description = "This black pocket phone book has all the phone numbers needed to get a hold of everyone in the future.", YearTimeLocationID = 6, HasValue = false, Value = 40, CanAddToInventory = true }); Treasures.Add(new Treasure { Name = "Nikes", TreasureType = Treasure.Type.Nikes, GameObjectID = 6, Description = "These Nikes are the second Air Jordan's that everyone has been looking for.", YearTimeLocationID = 5, HasValue = true, Value = 80, CanAddToInventory = true }); }
static void Play() { ColorPrint("Welcome to Dungeon Crawl.\n", ConsoleColor.Red); bool exit = false; string input = ""; //List<string> inputList while (!exit) { ColorPrint($"HP >", ConsoleColor.Green); input = Console.ReadLine(); var inputList = input.Split(' '); switch (inputList[0]) { case "room": Room.Display(); break; case "weapon": Weapon.Display(); break; case "potion": Potion.Display(); break; case "treasure": Treasures.Display(); break; case "item": Item.Display(); break; case "mob": Mob.Display(); break; case "north": Move("north"); break; case "south": Move("south"); break; case "look": PrintList(inputList[1]); break; case "exit": exit = true; break; default: Console.WriteLine("Command not found!"); break; } } }
internal override Event ReadEntry(BinaryReaderEx br) { EventType type = br.GetEnum32 <EventType>(br.Position + 8); switch (type) { case EventType.Light: var light = new Event.Light(br); Lights.Add(light); return(light); case EventType.Sound: var sound = new Event.Sound(br); Sounds.Add(sound); return(sound); case EventType.SFX: var sfx = new Event.SFX(br); SFXs.Add(sfx); return(sfx); case EventType.WindSFX: var windSFX = new Event.WindSFX(br); WindSFXs.Add(windSFX); return(windSFX); case EventType.Treasure: var treasure = new Event.Treasure(br); Treasures.Add(treasure); return(treasure); case EventType.Generator: var generator = new Event.Generator(br); Generators.Add(generator); return(generator); case EventType.Message: var message = new Event.Message(br); Messages.Add(message); return(message); case EventType.ObjAct: var objAct = new Event.ObjAct(br); ObjActs.Add(objAct); return(objAct); case EventType.SpawnPoint: var spawnPoint = new Event.SpawnPoint(br); SpawnPoints.Add(spawnPoint); return(spawnPoint); case EventType.MapOffset: var mapOffset = new Event.MapOffset(br); MapOffsets.Add(mapOffset); return(mapOffset); case EventType.Navmesh: var navmesh = new Event.Navmesh(br); Navmeshes.Add(navmesh); return(navmesh); case EventType.Environment: var environment = new Event.Environment(br); Environments.Add(environment); return(environment); case EventType.PseudoMultiplayer: var pseudoMultiplayer = new Event.PseudoMultiplayer(br); PseudoMultiplayers.Add(pseudoMultiplayer); return(pseudoMultiplayer); default: throw new NotImplementedException($"Unsupported event type: {type}"); } }
public void Add(IMsbEvent item) { switch (item) { case Event.Light e: Lights.Add(e); break; case Event.Sound e: Sounds.Add(e); break; case Event.SFX e: SFXs.Add(e); break; case Event.WindSFX e: WindSFXs.Add(e); break; case Event.Treasure e: Treasures.Add(e); break; case Event.Generator e: Generators.Add(e); break; case Event.Message e: Messages.Add(e); break; case Event.ObjAct e: ObjActs.Add(e); break; case Event.SpawnPoint e: SpawnPoints.Add(e); break; case Event.MapOffset e: MapOffsets.Add(e); break; case Event.Navmesh e: Navmeshes.Add(e); break; case Event.Environment e: Environments.Add(e); break; case Event.PseudoMultiplayer e: PseudoMultiplayers.Add(e); break; default: throw new ArgumentException( message: "Item is not recognized", paramName: nameof(item)); } }