private INonPlayerCharacter Shaman() { INonPlayerCharacter npc = CreateNonplayerCharacter(MobType.Humanoid, 40); npc.ExamineDescription = "Wearing a pair of deer antlers and the pelts of a bear the shaman would stand out from any member of the goblin camp."; npc.LookDescription = "The shaman sways gently as he communes with spirits."; npc.ShortDescription = "The camps shaman."; npc.SentenceDescription = "goblin"; npc.KeyWords.Add("goblin"); npc.KeyWords.Add("shaman"); IEnchantment enchantment = new EnterRoomEnchantment(); IEffect say = new Message(); IEffectParameter effectParameter = new EffectParameter(); enchantment.ActivationPercent = 100; enchantment.Effect = say; TranslationPair translationPair = new TranslationPair(Objects.Global.Language.Translator.Languages.Goblin, "The spirits said you would come."); List <ITranslationPair> translationPairs = new List <ITranslationPair>() { translationPair }; effectParameter.RoomMessage = new TranslationMessage("The Shaman says \"{0}\"", TagType.Communication, translationPairs); effectParameter.RoomId = new RoomId(Zone.Id, 8); enchantment.Parameter = effectParameter; npc.Enchantments.Add(enchantment); return(npc); }
public BaseCureSpell(string spellName, int die, int sides, int manaCost = -1) { Effect = new RecoverHealth(); Parameter.Dice = GlobalReference.GlobalValues.DefaultValues.ReduceValues(die, sides); SpellName = spellName; SpellName = spellName; if (manaCost == -1) { ManaCost = sides * die / 20; } else { ManaCost = manaCost; } string roomMessage = "{performer} says {0} and their hands begin to glow causing {target} to look better."; string targetMessage = "{performer} says {0} and heals you."; string performerMessage = "You say {0} and heal {target}."; List <ITranslationPair> translate = new List <ITranslationPair>(); ITranslationPair pair = new TranslationPair(Translator.Languages.Magic, spellName); translate.Add(pair); RoomNotificationSuccess = new TranslationMessage(roomMessage, TagType.Info, translate); TargetNotificationSuccess = new TranslationMessage(targetMessage, TagType.Info, translate); PerformerNotificationSuccess = new TranslationMessage(performerMessage, TagType.Info, translate); }
public void Constructors() { Assert.Throws<ArgumentNullException>(() => new TranslationPair(null, "toLanguage")); Assert.Throws<ArgumentNullException>(() => new TranslationPair("fromLanguage", null)); Assert.Throws<ArgumentException>(() => new TranslationPair(string.Empty, "toLanguage")); Assert.Throws<ArgumentException>(() => new TranslationPair("fromLanguage", string.Empty)); var pair = new TranslationPair("fromLanguage", "toLanguage"); Assert.Equal("fromLanguage", pair.FromLanguage); Assert.Equal("toLanguage", pair.ToLanguage); }
public void Setup() { translationPair = new TranslationPair(Languages.Magic, "magic"); mob = new Mock <IMobileObject>(); translate = new Mock <ITranslator>(); mob.Setup(e => e.KnownLanguages).Returns(new HashSet <Languages>() { Languages.AncientMagic }); translate.Setup(e => e.Translate(Languages.Magic, "magic")).Returns("unknown"); GlobalReference.GlobalValues.Translator = translate.Object; }
private static ISpell BuildSpell(string spellName) { ISpell spell = new SingleTargetSpell(); spell.SpellName = spellName; spell.ManaCost = 0; spell.Parameter.Dice = GlobalReference.GlobalValues.DefaultValues.ReduceValues(1, 100); string message = "The nurse says {0} and is briefly surrounded in a aura of light."; List <ITranslationPair> translate = new List <ITranslationPair>(); ITranslationPair translationPair = new TranslationPair(Translator.Languages.Magic, spellName); translate.Add(translationPair); ITranslationMessage translationMessage = new TranslationMessage(message, TagType.Info, translate); spell.RoomNotificationSuccess = translationMessage; spell.PerformerNotificationSuccess = new TranslationMessage("you cast a spell"); return(spell); }
private static ISpell GenerateSpell(string spellName) { ISpell spell = new SingleTargetSpell(); spell.SpellName = spellName; spell.ManaCost = 0; spell.Parameter.Dice = new Dice(5, 2); string message = "The nurse says {0} and is briefly surrounded in a aura of light."; List <ITranslationPair> translate = new List <ITranslationPair>(); ITranslationPair translationPair = new TranslationPair(Translator.Languages.Magic, spellName); translate.Add(translationPair); ITranslationMessage translationMessage = new TranslationMessage(message, TagType.Info, translate); spell.RoomNotification = translationMessage; spell.PerformerNotification = new TranslationMessage("you cast a spell"); return(spell); }
private static Project Open_Do(string file, ProgressDisplay progress) { string machinePath = Path.Combine(Path.GetDirectoryName(file) ?? "", "TransuraetuMachine.json"); progress.Update("Loading machine translations...", .0); Dictionary <string, Dictionary <string, TranslationPair.MachineTranslations> > machineTranslations; if (File.Exists(machinePath)) { machineTranslations = JsonConvert.DeserializeObject <Dictionary <string, Dictionary <string, TranslationPair.MachineTranslations> > >( File.ReadAllText(machinePath)); } else { machineTranslations = new Dictionary <string, Dictionary <string, TranslationPair.MachineTranslations> >(); } progress.Update("Listing files...", .0); Project project = new Project(file); string dir = Path.Combine(Path.GetDirectoryName(file) ?? "", "patch"); string[] files = Directory.GetFiles(dir); int i = 1; // Used purely for progress bar foreach (string f in files) { string fn = Path.GetFileName(f); Dictionary <string, TranslationPair.MachineTranslations> machineTrs; if (!machineTranslations.TryGetValue(fn, out machineTrs)) { machineTrs = new Dictionary <string, TranslationPair.MachineTranslations>(); } progress.Update($"Reading file {fn} ({i}/{f.Length})", (double)i / f.Length); i++; string[] lines = File.ReadAllLines(f); if (!(lines.FirstOrDefault() ?? "").StartsWith("> RPGMAKER TRANS PATCH FILE VERSION 3")) { continue; } string header = lines.First(); lines = lines.Skip(1).ToArray(); List <TranslationPair> pairs = new List <TranslationPair>(); string original = ""; string translation = ""; List <string> context = new List <string>(); bool isTranslation = false; foreach (string line in lines) { if (line.StartsWith('>')) { if (line.StartsWith("> BEGIN STRING")) { isTranslation = false; original = ""; translation = ""; } else if (line.StartsWith("> CONTEXT:")) { isTranslation = true; context.Add(line); } else if (line.StartsWith("> END STRING")) { isTranslation = false; if (!string.IsNullOrWhiteSpace(original?.Trim())) { TranslationPair pair = new TranslationPair(original, translation, context.ToArray()); machineTrs.TryGetValue(pair.Original, out pair.machine); pairs.Add(pair); } original = ""; translation = ""; context.Clear(); } } else { ref string current = ref original; if (isTranslation) { current = ref translation; } if (!string.IsNullOrWhiteSpace(current)) { current += '\n'; } current += line; } } if (pairs.Count > 0) { project.patchFiles.Add(fn, new PatchFile { name = fn, header = header, pairs = pairs.ToArray() }); } }