public virtual void FinishLoad(int zoneObjectSyncValue = -1) { if (zoneObjectSyncValue != -1) { ZoneObjectSyncLoad(zoneObjectSyncValue); } if (_flavorOptions != null && _flavorOptions.Count != 0) { foreach (string key in FlavorOptions.Keys) { int selectedPosition = GlobalReference.GlobalValues.Random.Next(FlavorOptions[key].Count); string selectedFlavorOption = FlavorOptions[key][selectedPosition]; ShortDescription = ShortDescription.Replace(key, selectedFlavorOption); LongDescription = LongDescription.Replace(key, selectedFlavorOption); ExamineDescription = ExamineDescription.Replace(key, selectedFlavorOption); SentenceDescription = SentenceDescription.Replace(key, selectedFlavorOption); for (int i = 0; i < KeyWords.Count; i++) { KeyWords[i] = KeyWords[i].Replace(key, selectedFlavorOption); } } } ILoadableItems loadableItem = this as ILoadableItems; if (loadableItem != null) { if (loadableItem.LoadableItems.Count > 0) { foreach (ILoadPercentage percentage in loadableItem.LoadableItems) { if (percentage.Load) { AddItem(this, percentage.Object); percentage.Object.FinishLoad(); } } } } }
private void LoadEquipment(IRoom room) { ILoadableItems loadableRoom = (ILoadableItems)room; for (int level = 8; level < 15; level++) { loadableRoom.LoadableItems.Add(new LoadPercentage() { PercentageLoad = 7, Object = Sword(level) }); loadableRoom.LoadableItems.Add(new LoadPercentage() { PercentageLoad = 7, Object = Spear(level) }); IArmor armor = null; #region Arms armor = Arms(level); armor.Material = new Silver(); armor.ShortDescription = "A silver bracer."; armor.LongDescription = "A silver bracer looks like it would be a nice fit and good defense."; loadableRoom.LoadableItems.Add(new LoadPercentage() { PercentageLoad = 1, Object = armor }); armor = Arms(level); armor.Material = new Leather(); armor.ShortDescription = "A leather bracer."; armor.LongDescription = "The bracer is thick, sturdy and leather."; loadableRoom.LoadableItems.Add(new LoadPercentage() { PercentageLoad = 3, Object = armor }); armor = Arms(level); armor.Material = new Steel(); armor.ShortDescription = "A steel bracer."; armor.LongDescription = "The steel bracer has a small dent in it but nothing that will affect its performance."; loadableRoom.LoadableItems.Add(new LoadPercentage() { PercentageLoad = 3, Object = armor }); #endregion Arms #region Chest armor = Body(level); armor.Material = new Cloth(); armor.ShortDescription = "A padded vest."; armor.LongDescription = "The padded vest is has the emblem of the GrandView warrior guild."; armor.ExamineDescription = "The vest is a light brown color and the stitching for the padding is well hidden making it look like a regular vest."; armor.SentenceDescription = "vest"; armor.SentenceDescription = "padded vest"; loadableRoom.LoadableItems.Add(new LoadPercentage() { PercentageLoad = 1, Object = armor }); armor = Body(level); armor.Material = new Leather(); armor.ShortDescription = "A leather jacket."; armor.LongDescription = "The studded leather jacket looks to be intimidating."; armor.ExamineDescription = "Black as night the only thing that keeps this from being a good thief's outfit is the metal studs sticking out."; armor.SentenceDescription = "leather"; armor.SentenceDescription = "jacket"; armor.SentenceDescription = "studded"; loadableRoom.LoadableItems.Add(new LoadPercentage() { PercentageLoad = 3, Object = armor }); armor = Body(level); armor.Material = new Steel(); armor.ShortDescription = "A steel breast plate."; armor.LongDescription = "The steel breast plate is complete with a six pack on the front."; armor.ExamineDescription = "The breast plate even has a belly button. Inside the armor it has the creators initials. {FirstInitial}{SecondInitial}."; armor.SentenceDescription = "bracer"; armor.FlavorOptions.Add("{FirstInitial}", new List <string> { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" }); armor.FlavorOptions.Add("{SecondInitial}", new List <string> { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" }); loadableRoom.LoadableItems.Add(new LoadPercentage() { PercentageLoad = 3, Object = armor }); #endregion Chest #region Feet armor = Feet(level); armor.Material = new Silver(); armor.KeyWords.Clear(); armor.ShortDescription = "A silver pair of ballet slippers."; armor.LongDescription = "The silver slippers don't look like they would offer much protection."; armor.ExamineDescription = "The slippers hum slightly but other than that appear to be normal."; armor.SentenceDescription = "silver slippers"; armor.KeyWords.Add("silver"); armor.KeyWords.Add("slipper"); loadableRoom.LoadableItems.Add(new LoadPercentage() { PercentageLoad = 1, Object = armor }); armor = Feet(level); armor.Material = new Leather(); armor.ShortDescription = "Leather boots."; armor.LongDescription = "The boots are made of leather and appear to be sturdy."; loadableRoom.LoadableItems.Add(new LoadPercentage() { PercentageLoad = 3, Object = armor }); armor = Feet(level); armor.Material = new Steel(); armor.ShortDescription = "A steel boot."; armor.LongDescription = "The steel boots will give the user plenty of protection but will wear them out having to walking in them all day."; loadableRoom.LoadableItems.Add(new LoadPercentage() { PercentageLoad = 3, Object = armor }); #endregion Feet #region Hands armor = Hand(level); armor.Material = new Leather(); armor.ShortDescription = "Leather gloves."; armor.LongDescription = "The gloves have a fair amount of padding to protect the users hands."; loadableRoom.LoadableItems.Add(new LoadPercentage() { PercentageLoad = 3, Object = armor }); #endregion Hands #region Helmet armor = Helmet(level); armor.Material = new Gold(); armor.ShortDescription = "A gold helmet."; armor.LongDescription = "A golden helmet looks like it would be a nice fit and good defense."; loadableRoom.LoadableItems.Add(new LoadPercentage() { PercentageLoad = 1, Object = armor }); armor = Helmet(level); armor.Material = new Cloth(); armor.ShortDescription = "A cloth helmet."; armor.LongDescription = "While not the best defense it is better than nothing."; loadableRoom.LoadableItems.Add(new LoadPercentage() { PercentageLoad = 2, Object = armor }); armor = Helmet(level); armor.Material = new Leather(); armor.ShortDescription = "A leather helmet."; armor.LongDescription = "A fightings mans helmet. Better than cloth and not quite as good as steel but much more affordable."; loadableRoom.LoadableItems.Add(new LoadPercentage() { PercentageLoad = 3, Object = armor }); armor = Helmet(level); armor.Material = new Steel(); armor.ShortDescription = "A steel helmet."; armor.LongDescription = "The helmet is made of steel a tried and true material able to take a bashing while protecting the wearer."; loadableRoom.LoadableItems.Add(new LoadPercentage() { PercentageLoad = 3, Object = armor }); #endregion Helmet #region Legs armor = Leg(level); armor.Material = new Leather(); armor.ShortDescription = "Leather pants."; armor.LongDescription = "A pair of pants that once belonged to a member of the phoenix guild."; loadableRoom.LoadableItems.Add(new LoadPercentage() { PercentageLoad = 3, Object = armor }); #endregion Legs } }
IZone IZoneCode.Generate() { RandomZoneGeneration randZoneGen = new RandomZoneGeneration(10, 10, zoneId); RoomDescription description = new RoomDescription(); description.LongDescription = "This part of the field is tilled and ready to be planted."; description.ExamineDescription = "The dirt is rich and will support a good crop."; description.ShortDescription = "Farmland"; randZoneGen.RoomDescriptions.Add(description); description = new RoomDescription(); description.LongDescription = "While the {crop} looks healthy it is still to young to eat."; description.ExamineDescription = "A tall crop of {crop} is growing here."; description.ShortDescription = "Farmland"; FlavorOption option = new FlavorOption(); option.FlavorValues.Add("{crop}", new List <string>() { "corn", "wheat", "grapes" }); description.FlavorOption.Add(option); randZoneGen.RoomDescriptions.Add(description); description = new RoomDescription(); description.LongDescription = "The field is full of tall grass."; description.ExamineDescription = "The field is full of tall grass that seems to flow around you as you walk through it."; description.ShortDescription = "Farmland"; randZoneGen.RoomDescriptions.Add(description); option = new FlavorOption(); option.FlavorText = "A {type} fence runs parallel to you a {distance} away."; option.FlavorValues.Add("{type}", new List <string>() { "wooden", "stone" }); option.FlavorValues.Add("{distance}", new List <string>() { "short", "long" }); randZoneGen.RoomFlavorText.Add(option); option = new FlavorOption(); option.FlavorText = "A rusted horse shoe has been lost and lies rusting away."; randZoneGen.RoomFlavorText.Add(option); option = new FlavorOption(); option.FlavorText = "A small hill rises to the {direction} in the distance."; option.FlavorValues.Add("{direction}", new List <string>() { "north", "east", "south", "west" }); randZoneGen.RoomFlavorText.Add(option); IZone zone = randZoneGen.Generate(); zone.InGameDaysTillReset = 1; zone.Name = nameof(GrandViewDeepForest); description = new RoomDescription(); description.LongDescription = "A road runs through the farm lands."; description.ExamineDescription = "Two wagon ruts cut into the soil."; description.ShortDescription = "Road"; randZoneGen.RoadDescription = description; randZoneGen.AddRoad(zone, null, new ZoneConnection() { ZoneId = 8, RoomId = 1 }, new ZoneConnection() { ZoneId = 14, RoomId = 6 }, new ZoneConnection() { ZoneId = 4, RoomId = 6 }); int animalChoices = 0; MethodInfo[] methods = this.GetType().GetMethods(BindingFlags.NonPublic | BindingFlags.Instance); foreach (MethodInfo info in methods) { if (info.ReturnType == typeof(INonPlayerCharacter) && info.Name != "BuildNpc") { animalChoices++; } } int percent = 20 / animalChoices; foreach (IRoom room in zone.Rooms.Values) { ILoadableItems loadable = (ILoadableItems)room; loadable.LoadableItems.Add(new LoadPercentage() { PercentageLoad = percent, Object = Cow() }); loadable.LoadableItems.Add(new LoadPercentage() { PercentageLoad = percent, Object = Horse() }); loadable.LoadableItems.Add(new LoadPercentage() { PercentageLoad = percent, Object = Chicken() }); } return(zone); }
public IZone Generate() { List <string> names = new List <string>() { "Falim Nasha", "Bushem Dinon", "Stavelm Eaglelash", "Giu Thunderbash", "Marif Hlisk", "Fim Grirgav", "Strarcar Marshgem", "Storth Shadowless", "Tohkue-zid Lendikrafk", "Vozif Jikrehd", "Dranrovelm Igenomze", "Zathis Vedergi", "Mieng Chiao", "Thuiy Chim", "Sielbonron Canderger", "Craldu Gacevi", "Rumeim Shennud", "Nilen Cahrom", "Bei Ashspark", "Hii Clanbraid", "Sodif Vatsk", "Por Rorduz", "Grorcerth Forestsoar", "Gath Distantthorne", "Duhvat-keuf Faltrueltrim", "Ham-kaoz Juhpafk", "Rolvoumvald Gibenira", "Rondit Vumregi", "Foy Sheiy", "Fiop Tei", "Fruenrucu Jalbese", "Fhanun Guldendal" }; RandomZoneGeneration randZoneGen = new RandomZoneGeneration(5, 5, Zone.Id); RoomDescription description = new RoomDescription(); description.LookDescription = "The dirt has been freshly disturbed where a body has been recently placed in the ground."; description.ExamineDescription = "Some flowers have been placed on the headstone that belongs to {name}."; description.ShortDescription = "Graveyard"; randZoneGen.RoomDescriptions.Add(description); description = new RoomDescription(); description.LookDescription = "The headstone has been here a while and is starting to show its age."; description.ExamineDescription = "The headstone name has worn off and is impossible to read."; description.ShortDescription = "Graveyard"; randZoneGen.RoomDescriptions.Add(description); description = new RoomDescription(); description.LookDescription = "A grand tower of marble rises to the sky. This person must have been important or rich in life."; description.ExamineDescription = "The tombstone belongs to {name}."; description.ShortDescription = "Graveyard"; randZoneGen.RoomDescriptions.Add(description); description = new RoomDescription(); description.LookDescription = "A small flat stone marker is all shows where this person is buried."; description.ExamineDescription = "The grave marker belongs to {name}."; description.ShortDescription = "Graveyard"; randZoneGen.RoomDescriptions.Add(description); description = new RoomDescription(); description.LookDescription = "There is a small bench for resting as one walks among the tombstones."; description.ExamineDescription = "A pair of angles are carved into the sides of the feet on the bench."; description.ShortDescription = "Graveyard"; randZoneGen.RoomDescriptions.Add(description); description = new RoomDescription(); description.LookDescription = "Crosses give hint that the owner might have been religions in life."; description.ExamineDescription = "Here lies {name}."; description.ShortDescription = "Graveyard"; randZoneGen.RoomDescriptions.Add(description); description = new RoomDescription(); description.LookDescription = "The statue a weeping angle stands watch over the deceased."; description.ExamineDescription = "The grave belongs to {name}."; description.ShortDescription = "Graveyard"; randZoneGen.RoomDescriptions.Add(description); FlavorOption option = new FlavorOption(); option.FlavorValues.Add("{name}", names); description.FlavorOption.Add(option); randZoneGen.RoomDescriptions.Add(description); Zone = randZoneGen.Generate(); Zone.Name = nameof(GrandViewGraveYard); int creatueChoices = 0; MethodInfo[] methods = this.GetType().GetMethods(BindingFlags.NonPublic | BindingFlags.Instance); foreach (MethodInfo info in methods) { if (info.ReturnType == typeof(INonPlayerCharacter) && info.Name != "BuildNpc") { creatueChoices++; } } int percent = (int)Math.Round(5d / creatueChoices, 0); List <int> hoursToSpawnUndead = new List <int>(); for (int i = 12; i < 24; i++) { hoursToSpawnUndead.Add(i); } HeartbeatBigTickEnchantment enchantmentSkeleton = new HeartbeatBigTickEnchantment(); enchantmentSkeleton.ActivationPercent = .2; enchantmentSkeleton.Effect = new LoadMob() { HoursToLoad = hoursToSpawnUndead }; enchantmentSkeleton.Parameter = new EffectParameter() { Performer = Skeleton(), RoomMessage = new TranslationMessage("The skeleton rises slowly out of its grave.") }; HeartbeatBigTickEnchantment enchantmentZombie = new HeartbeatBigTickEnchantment(); enchantmentSkeleton.ActivationPercent = .2; enchantmentZombie.Effect = new LoadMob() { HoursToLoad = hoursToSpawnUndead }; enchantmentZombie.Parameter = new EffectParameter() { Performer = Zombie(), RoomMessage = new TranslationMessage("A zombie burst forth from it grave hungry for brains.") }; foreach (IRoom room in Zone.Rooms.Values) { ILoadableItems loadable = (ILoadableItems)room; loadable.LoadableItems.Add(new LoadPercentage() { PercentageLoad = percent, Object = Crow() }); room.Attributes.Add(RoomAttribute.Outdoor); room.Attributes.Add(RoomAttribute.Weather); room.Enchantments.Add(enchantmentSkeleton); room.Enchantments.Add(enchantmentZombie); } SetRoom13(); Zone.Rooms.Add(26, Room26()); ConnectRooms(); return(Zone); }
private static void VerifyRoom(IRoom room) { string type = "Room "; VerifyIds(room, type); VerifyDescriptions(room, type); foreach (IItem item in room.Items) { VerifyItem(item); } foreach (IEnchantment item in room.Enchantments) { VerifyEnchantment(item); } ILoadableItems loadableItems = room as ILoadableItems; foreach (ILoadPercentage loadPercentage in loadableItems.LoadableItems) { IItem item = loadPercentage.Object as IItem; if (item != null) { VerifyItem(item); } INonPlayerCharacter nonPlayerCharacter = loadPercentage.Object as INonPlayerCharacter; if (nonPlayerCharacter != null) { VerifyNpc(nonPlayerCharacter); } IMount mount = loadPercentage.Object as IMount; if (mount != null) { VerifyMount(mount); } } foreach (INonPlayerCharacter npc in room.NonPlayerCharacters) { VerifyNpc(npc); } foreach (IMobileObject mobileObject in room.OtherMobs) { if (mobileObject is IMount) { VerifyMount(mobileObject as IMount); } else { VerifyMob(mobileObject); } } if (room.Attributes.Count == 0) { ThrowConfigException(room, type, "Room attributes blank."); } else if (room.Attributes.Contains(RoomAttribute.Outdoor)) { if (!room.Attributes.Contains(RoomAttribute.Weather)) { Console.WriteLine($"Room {room.Zone} - {room.Id} has outdoors but not weather."); } } CheckRoomDoors(room); }