void removeToaster(string player, bool quiet) { LinkedListNode <Toaster> t = findToaster(player); if (t != null) { // Remove the player from the toasters list. m_toasters.Remove(t); // Get information on the player. Furnarchy.MonsterInfo info = m_host.World.getMonsterInfo(player); if (info.guid != 0) { // Revert his frame number to its real value. if (m_host.Enabled && info.visible) { updateAvatar(info.guid, t.Value.frame, info.colors); } } if (!quiet) { if (m_host.Enabled) { m_host.speak(String.Format("{0} is no longer a toaster!", player)); } else { m_host.speak(String.Format("{0} will no longer be a toaster!", player)); } } } }
// An avatar should be displayed with the specified frame and position. // This variant does not move your camera if the avatar happens to be you. void onInboundAvatarShow2(object sender, Furnarchy.InboundAvatarShow2EventArgs e) { if (m_host.Enabled) { // Use the World subsystem to find the avatar's name. Furnarchy.MonsterInfo info = m_host.World.getMonsterInfo(e.guid); if (info.guid != 0) { LinkedListNode <Toaster> t = findToaster(info.name); if (t != null) { // This avatar is in our toaster list! // Rebuild the command so that the avatar frame is a toaster. // The basic format of an avatar show (2) command is: // D{guid}{x}{y}{frame}######## // format() can easily build this line for us. e.line = m_host.Net.format("D%4N%2N%2N%2N########", e.guid, e.x, e.y, makeToasterFrame(e.frame)); // Remember the avatar's real frame number in case we have to un-toaster him later. t.Value = new Toaster(t.Value.shortname, e.frame); } } } }
void onDisabled(object sender, EventArgs e) { m_host.speak(String.Format("\"{0}\" disabled!", m_host.FancyName)); // Revert all toasters' avatars. for (LinkedListNode <Toaster> i = m_toasters.First; i != null; i = i.Next) { Furnarchy.MonsterInfo info = m_host.World.getMonsterInfo(i.Value.shortname); if (info.guid != 0) { // Change the avatar's frame number to a toaster's. if (info.visible) { updateAvatar(info.guid, i.Value.frame, info.colors); } } } }
void onEnabled(object sender, EventArgs e) { m_host.speak(String.Format("\"{0}\" enabled! {1} people are toasters!", m_host.FancyName, m_toasters.Count)); // Update all toasters' avatars. for (LinkedListNode <Toaster> i = m_toasters.First; i != null; i = i.Next) { Furnarchy.MonsterInfo info = m_host.World.getMonsterInfo(i.Value.shortname); if (info.guid != 0) { // Remember the avatar's real frame number. i.Value = new Toaster(i.Value.shortname, info.frame); // Change the avatar's frame number to a toaster's. if (info.visible) { updateAvatar(info.guid, makeToasterFrame(info.frame), info.colors); } } } }
void addToaster(string player, bool quiet) { // Avoid duplicates. if (findToaster(player) == null) { // Create a new Toaster. Toaster t; t.shortname = m_host.makeShortname(player); t.frame = 0; // Get information on the player. Furnarchy.MonsterInfo info = m_host.World.getMonsterInfo(player); if (info.guid != 0) { t.frame = info.frame; // Change his frame number to a toaster's. if (m_host.Enabled && info.visible) { updateAvatar(info.guid, makeToasterFrame(info.frame), info.colors); } } // Add him to the list of toasters. m_toasters.AddFirst(t); if (!quiet) { if (m_host.Enabled) { m_host.speak(String.Format("{0} is now a toaster!", player)); } else { m_host.speak(String.Format("{0} will be a toaster once {1} is enabled!", player, m_host.FancyName)); } } } }