private static AvalableItemPosition PickRandomItemPosition() { Array values = Enum.GetValues(typeof(AvalableItemPosition)); int randomValue = GlobalReference.GlobalValues.Random.Next(values.Length - 1); //don't pick not worn AvalableItemPosition itemPosition = (AvalableItemPosition)values.GetValue(randomValue); return(itemPosition); }
public IResult PerformCommand(IMobileObject performer, ICommand command) { IPlayerCharacter pc = performer as IPlayerCharacter; if (pc == null) { return(new Result(false, "Only player characters can have craftsman craft items.")); } INonPlayerCharacter craftsman = null; ICraftsman craftsmanPersonality = null; FindCraftsman(performer, ref craftsman, ref craftsmanPersonality); if (craftsman == null) { return(new Result(false, "There is no craftsman to make anything for you.")); } if (command.Parameters.Count < 7) { return(new Result(false, "Please provide all the parameters needed for the craftsman to make your item.")); } try { AvalableItemPosition position = GetPosition(command.Parameters[0].ParameterValue); if (position == AvalableItemPosition.Wield && command.Parameters.Count < 8) { return(new Result(false, "Damage type is required for weapons.")); } int level = int.Parse(command.Parameters[1].ParameterValue); string keyword = command.Parameters[2].ParameterValue; string sentenceDescription = command.Parameters[3].ParameterValue; string shortDescription = command.Parameters[4].ParameterValue; string longDescription = command.Parameters[5].ParameterValue; string examineDescription = command.Parameters[6].ParameterValue; DamageType damageType = DamageType.Acid; if (position == AvalableItemPosition.Wield) { damageType = GetDamageType(command.Parameters[7].ParameterValue); } return(craftsmanPersonality.Build(craftsman, pc, position, level, keyword, sentenceDescription, shortDescription, longDescription, examineDescription, damageType)); } catch (Exception ex) { if (ex is ArgumentException) { return(new Result(false, ex.Message)); } else { return(new Result(false, "Please verify all parameters and try again.")); } } }
private static IArmor Armor(AvalableItemPosition avalableItemPosition) { IArmor armor = new Armor(); armor.ItemPosition = avalableItemPosition; armor.Level = 45; armor.Dice = GlobalReference.GlobalValues.DefaultValues.DiceForArmorLevel(armor.Level + 2); armor.Material = new Silver(); return(armor); }
public IArmor CreateArmor(AvalableItemPosition position, int level, BaseMaterial material = null) { IArmor armor = new Armor(); armor.Id = ItemId++; armor.Zone = Zone.Id; armor.ItemPosition = position; armor.Level = level; armor.Dice = GlobalReference.GlobalValues.DefaultValues.DiceForArmorLevel(level); armor.Material = material; return(armor); }
public IResult PerformCommand(IMobileObject performer, ICommand command) { IResult result = base.PerfomCommand(performer, command); if (result != null) { return(result); } if (!(performer is IPlayerCharacter pc)) { return(new Result("Only player characters can have craftsman craft items.", true)); } INonPlayerCharacter craftsman = null; ICraftsman craftsmanPersonality = null; FindCraftsman(performer, ref craftsman, ref craftsmanPersonality); if (craftsman == null) { return(new Result("There is no craftsman to make anything for you.", true)); } if (command.Parameters.Count < 7) { return(new Result("Please provide all the parameters needed for the craftsman to make your item.", true)); } try { AvalableItemPosition position = GetPosition(command.Parameters[0].ParameterValue); if (position == AvalableItemPosition.Wield && command.Parameters.Count < 8) { return(new Result("Damage type is required for weapons.", true)); } int level = int.Parse(command.Parameters[1].ParameterValue); string keyword = command.Parameters[2].ParameterValue; string sentenceDescription = command.Parameters[3].ParameterValue; string shortDescription = command.Parameters[4].ParameterValue; string lookDescription = command.Parameters[5].ParameterValue; string examineDescription = command.Parameters[6].ParameterValue; DamageType damageType = DamageType.Acid; if (position == AvalableItemPosition.Wield) { damageType = GetDamageType(command.Parameters[7].ParameterValue); } if (level > craftsman.Level) { craftsman.EnqueueCommand($"Tell {performer.KeyWords[0]} That is above my skill level. You will need to find someone a higher level to craft such an item."); return(new Result(null, true)); } return(craftsmanPersonality.Build(craftsman, pc, position, level, keyword, sentenceDescription, shortDescription, lookDescription, examineDescription, damageType)); } catch (Exception ex) { if (ex is ArgumentException) { return(new Result(ex.Message, true)); } else { return(new Result("Please verify all parameters and try again.", true)); } } }
public IResult Build(INonPlayerCharacter craftsman, IPlayerCharacter performer, AvalableItemPosition position, int level, string keyword, string sentenceDescription, string shortDescription, string lookDescription, string examineDescription, DamageType damageType = DamageType.Slash) { IResult result; IItem item = null; switch (position) { case Equipment.AvalableItemPosition.Held: IEquipment equipment = new Equipment(); result = BuildItem(craftsman, performer, position, level, keyword, sentenceDescription, shortDescription, lookDescription, examineDescription, equipment); item = equipment; break; case Equipment.AvalableItemPosition.Wield: IWeapon weapon = new Weapon(); result = BuildItem(craftsman, performer, position, level, keyword, sentenceDescription, shortDescription, lookDescription, examineDescription, weapon); IDamage damage = new Damage.Damage(GlobalReference.GlobalValues.DefaultValues.DiceForWeaponLevel(weapon.Level)); damage.Type = damageType; weapon.DamageList.Add(damage); item = weapon; break; case Equipment.AvalableItemPosition.NotWorn: craftsman.EnqueueCommand($"Tell {performer.KeyWords[0]} I can not build that."); result = new Result("", true); break; default: IArmor armor = new Armor(); result = BuildItem(craftsman, performer, position, level, keyword, sentenceDescription, shortDescription, lookDescription, examineDescription, armor); item = armor; break; } if (!result.AllowAnotherCommand) { ICraftsmanObject craftsmanObject = new CraftsmanObject(); craftsmanObject.CraftsmanId = new BaseObjectId(craftsman); craftsmanObject.CraftmanDescripition = craftsman.ShortDescription; craftsmanObject.Completion = DateTime.Now.AddMinutes(item.Level); //make it take 1 hour game for each level craftsmanObject.Item = item; performer.CraftsmanObjects.Add(craftsmanObject); } return(result); }
public IArmor GenerateRandomArmor(int level, int effectiveLevel, AvalableItemPosition itemPosition) { while (itemPosition == AvalableItemPosition.Held || itemPosition == AvalableItemPosition.Wield) { itemPosition = PickRandomItemPosition(); } IArmor armor = new Armor(); armor.Level = level; armor.Dice = GlobalReference.GlobalValues.DefaultValues.DiceForArmorLevel(effectiveLevel); armor.ItemPosition = itemPosition; BaseMaterial randomMaterial = Materials[GlobalReference.GlobalValues.Random.Next(Materials.Count)]; armor.Material = randomMaterial; switch (itemPosition) { case AvalableItemPosition.Head: armor.ExamineDescription = "The helmet has two small holes cut out for seeing out."; armor.LookDescription = "The helmet is hard and light but well padded giving the ultimate compromise between protection and usability."; armor.ShortDescription = "A well made helmet that looks like it might fit."; armor.SentenceDescription = "helmet"; armor.KeyWords.Add("helmet"); break; case AvalableItemPosition.Neck: armor.ExamineDescription = "A {color} stone rests softly in the middle of the necklace."; armor.LookDescription = "The necklace has a stone attached to it via a round pendent."; armor.ShortDescription = "A delicate necklace fit for any royal lady to wear to any party."; armor.SentenceDescription = "necklace"; armor.KeyWords.Add("necklace"); armor.FlavorOptions.Add("{color}", new List <string>() { "black", "clear", "royal purple", "crimson red", "ocean blue", "emerald green" }); break; case AvalableItemPosition.Arms: armor.ExamineDescription = "The bracer is made of strips of material held together with leather."; armor.LookDescription = "Just a hair longer than your arm these bracers look to be a perfect fit."; armor.ShortDescription = "A pair of bracers that look to offer good protection for your arms."; armor.SentenceDescription = "bracer"; armor.KeyWords.Add("bracer"); break; case AvalableItemPosition.Hand: armor.ExamineDescription = "Made of a thin material these gloves have a magical property to them that grants the wearer protection."; armor.LookDescription = "The gloves have a {back} design on the back and a {inside} for the design on the inside."; armor.ShortDescription = "The gloves look to be thin and not offer much protection."; armor.SentenceDescription = "gloves"; armor.KeyWords.Add("gloves"); armor.FlavorOptions.Add("{back}", new List <string>() { "spider web", "unicorn", "lion", "fountain", "eagle", "griffin" }); armor.FlavorOptions.Add("{inside}", new List <string>() { "spider", "scorpion", "knights head", "horse", "sea shell", "mountain" }); break; case AvalableItemPosition.Finger: armor.ExamineDescription = "The ring once had a design on the inside but has been worn smooth with time."; armor.LookDescription = "The ring is smooth on the outside{design}."; armor.ShortDescription = "The ring is a simple ring with no special markings or anything to suggest it is magical."; armor.SentenceDescription = "ring"; armor.KeyWords.Add("ring"); armor.FlavorOptions.Add("{design}", new List <string>() { "", " and has a {color} stone on the top" }); armor.FlavorOptions.Add("{color}", new List <string>() { "black", "clear", "royal purple", "crimson red", "ocean blue", "emerald green" }); break; case AvalableItemPosition.Body: armor.ExamineDescription = "There is a large emblem on the front of a {emblem}."; armor.LookDescription = "The breastplate is hard giving the wearer plenty of protection while being light."; armor.ShortDescription = "A strong breastplate that has a small dent in the left side but otherwise is in perfect condition."; armor.SentenceDescription = "breastplate"; armor.KeyWords.Add("breastplate"); armor.KeyWords.Add("breast"); armor.KeyWords.Add("plate"); armor.FlavorOptions.Add("{emblem}", new List <string>() { "tree", "griffin", "meteor", "pair of lions on either side of a crown", "pair of lions on either side of a shield" }); break; case AvalableItemPosition.Waist: armor.ExamineDescription = "The belt is made of an unknown material that shifts colors through all the colors of the rainbow."; armor.LookDescription = "The belt is prismatic. The color shifts through the rainbow as you move relative to it."; armor.ShortDescription = "The belt is a prismatic color that shifts wildly."; armor.SentenceDescription = "belt"; armor.KeyWords.Add("belt"); break; case AvalableItemPosition.Legs: armor.ExamineDescription = "The pattern on the leggings produce a soft blue glow."; armor.LookDescription = "The leggings have are a dark gray color with delicately carved curving lines on the front forming a intricate pattern."; armor.ShortDescription = "A pair of leggings."; armor.SentenceDescription = "legging"; armor.KeyWords.Add("legging"); break; case AvalableItemPosition.Feet: armor.ExamineDescription = "Three pouches hang off the outside of each boot allowing you to have quick access to small items."; armor.LookDescription = "Made of supple leather the boots are soft and easy to wear at the expense of some protection."; armor.ShortDescription = "A pair of leather boots."; armor.SentenceDescription = "boot"; armor.KeyWords.Add("boot"); break; } armor.FinishLoad(); return(armor); }
public IArmor GenerateRandomArmor(int level, int effectiveLevel) { AvalableItemPosition itemPosition = PickRandomItemPosition(); return(GenerateRandomArmor(level, effectiveLevel, itemPosition)); }