public Dialog(string id, DialogType type, DialogTone tone, DialogEntry entry, params DialogEntry[] rest) { Id = id; Type = type; Tone = tone; Entries = rest.Prepend(entry); }
public AppearanceNode GetReactionOrDefault(DialogTone tone) { if (Expressions.ContainsKey(tone)) { return(Expressions[tone]); } return(Expressions[DialogTone.Neutral]); }
private async Task UpdateMessageAsync(DialogTone tone, string chatBox) { // TODO: Implement deleting messages if a bot has permission to if (Npc.Model != null && LastTone != tone) { MessageReference = await MessageReference.ReplaceAsync(Npc.Model.Render(tone, Palette), "../tmp/npc.png", chatBox, deleteLastMessage : true); LastTone = tone; } else { await MessageReference.ModifyAsync(chatBox); } }
// TODO: Move to GraphicsHandler public Bitmap Render(DialogTone tone, GammaPalette palette) { Bitmap result = new Bitmap(72, 64); using (Graphics g = Graphics.FromImage(result)) { // replace this with the interior images provided from a Location. using (Bitmap bg = new Bitmap("../assets/npcs/npc_frame.png")) ImageHelper.ClipAndDrawImage(g, bg, new Point(0, 0)); using (Bitmap body = Body.Value.GetImage()) ImageHelper.ClipAndDrawImage(g, body, Body.GetOffset()); using (Bitmap head = Head.Value.GetImage()) ImageHelper.ClipAndDrawImage(g, head, Head.GetOffset()); using (Bitmap face = GetReactionOrDefault(tone).Value.GetImage()) ImageHelper.ClipAndDrawImage(g, face, DefaultFaceOffset); } result = ImageHelper.SetColorMap(result, GammaPalette.Default, palette); result = ImageHelper.Scale(result, 2, 2); return(result); }