public static void PopulateHomes() { ArrayList patrons = new ArrayList(); foreach (Mobile patron in World.Mobiles.Values) { if (patron is HouseVisitor) { patrons.Add(patron); } } for (int i = 0; i < patrons.Count; ++i) { Mobile person = ( Mobile )patrons[i]; person.Delete(); } ArrayList tables = new ArrayList(); foreach (Item item in World.Items.Values) { if (item is TavernTable && !item.Movable) { tables.Add(item); } } for (int i = 0; i < tables.Count; ++i) { Item item = ( Item )tables[i]; TavernTable table = (TavernTable)item; AddPatrons(table); } }
public static void RemovePatrons(TavernTable table) { List <Mobile> targets = new List <Mobile>(); foreach (Mobile m in table.GetMobilesInRange(1)) { if (m.Map == table.Map && m is HouseVisitor && (m == table.DrinkerNorth || m == table.DrinkerSouth || m == table.DrinkerEast || m == table.DrinkerWest)) { targets.Add(m); } } for (int i = 0; i < targets.Count; ++i) { Mobile m = targets[i]; m.Delete(); } }
public TavernGump(TavernTable table) : base(25, 25) { m_Table = table; this.Closable = true; this.Disposable = true; this.Dragable = true; this.Resizable = false; AddPage(0); AddImage(0, 0, 155); AddImage(300, 0, 155); AddImage(0, 300, 155); AddImage(300, 300, 155); AddImage(2, 2, 129); AddImage(298, 2, 129); AddImage(2, 298, 129); AddImage(298, 298, 129); AddImage(5, 6, 133); AddImage(234, 45, 132); AddImage(414, 536, 130); AddImage(25, 365, 128); AddImage(600, 0, 155); AddImage(600, 300, 155); AddImage(598, 2, 129); AddImage(598, 298, 129); AddImage(670, 38, 149); AddImage(431, 45, 132); AddImage(571, 536, 130); AddImage(851, 531, 143); AddItem(788, 407, 21977); int button = 3609; // EAST if (m_Table.PatronEast > 0) { button = 4017; } else { button = 3609; } AddButton(841, 468, button, button, 1, GumpButtonType.Reply, 0); // SOUTH if (m_Table.PatronSouth > 0) { button = 4017; } else { button = 3609; } AddButton(751, 468, button, button, 2, GumpButtonType.Reply, 0); // NORTH if (m_Table.PatronNorth > 0) { button = 4017; } else { button = 3609; } AddButton(841, 398, button, button, 3, GumpButtonType.Reply, 0); // WEST if (m_Table.PatronWest > 0) { button = 4017; } else { button = 3609; } AddButton(751, 398, button, button, 4, GumpButtonType.Reply, 0); AddItem(753, 206, 21534); AddHtml(117, 103, 606, 324, @"<BODY><BIG><BASEFONT Color=#FCFF00>Tavern tables are small drinking tables that you can place in your home. When these are properly locked down, you can configure the table for the number of patrons that will stand next to the table. These patrons will be random adventurers, temporarily seeking refuge in your home. They provide no benefit other than offer their company and brief or vague tales of adventure. Every so often, the adventurers will move on and others will take their place to rest. Simply check the boxes by the table icon, where you want patrons to stand.<br><br>Remember, these patrons will not aid you on your quests like the citizens you encounter in the villages and towns. They will not repair your items, sell you unusual items, or randomly tell others where a special relic or character is located. They simply provide your home with a bit of atmosphere. Placing many tables with many patrons will not aid you in finding the location of Exodus or the last known location of the Candle of Love. They will not give you clues on where you can find museum relics or items needed for a quest you have taken from a dead adventurer's journal. So place them sparingly in your home so you can best see what they may be talking about with each other. Lastly, a lone patron at a table will have no one to talk to so if you want them to chatter then make sure you have at least two patrons per table.</BIG></BASEFONT></BODY>", (bool)false, (bool)false); AddHtml(273, 67, 382, 22, @"<BODY><BASEFONT Color=#FBFBFB><BIG><CENTER>TAVERN TABLES</CENTER></BIG></BASEFONT></BODY>", (bool)false, (bool)false); AddItem(751, 270, 19717); AddItem(450, 450, 21978); AddItem(650, 450, 21977); AddItem(550, 450, 21978); AddItem(826, 328, 3011); }
public static void AddPatrons(TavernTable table) { RemovePatrons(table); Point3D location = new Point3D(0, 0, 0); Direction direction = Direction.East; Mobile patron = null; if (table.PatronNorth > 0 && !table.Movable) { location = new Point3D(table.X, table.Y - 1, table.Z); if ((table.Map).CanSpawnMobile(table.X, table.Y - 1, table.Z)) { direction = Direction.South; patron = new HouseVisitor(); patron.MoveToWorld(location, table.Map); patron.Direction = direction; table.DrinkerNorth = patron; Server.Misc.TavernPatrons.RemoveSomeGear(patron, true); } else { table.PatronNorth = 0; } } if (table.PatronSouth > 0 && !table.Movable) { location = new Point3D(table.X, table.Y + 1, table.Z); if ((table.Map).CanSpawnMobile(table.X, table.Y + 1, table.Z)) { direction = Direction.North; patron = new HouseVisitor(); patron.MoveToWorld(location, table.Map); patron.Direction = direction; table.DrinkerSouth = patron; Server.Misc.TavernPatrons.RemoveSomeGear(patron, true); } else { table.PatronSouth = 0; } } if (table.PatronEast > 0 && !table.Movable) { location = new Point3D(table.X + 1, table.Y, table.Z); if ((table.Map).CanSpawnMobile(table.X + 1, table.Y, table.Z)) { direction = Direction.West; patron = new HouseVisitor(); patron.MoveToWorld(location, table.Map); patron.Direction = direction; table.DrinkerEast = patron; Server.Misc.TavernPatrons.RemoveSomeGear(patron, true); } else { table.PatronEast = 0; } } if (table.PatronWest > 0 && !table.Movable) { location = new Point3D(table.X - 1, table.Y, table.Z); if ((table.Map).CanSpawnMobile(table.X - 1, table.Y, table.Z)) { direction = Direction.East; patron = new HouseVisitor(); patron.MoveToWorld(location, table.Map); patron.Direction = direction; table.DrinkerWest = patron; Server.Misc.TavernPatrons.RemoveSomeGear(patron, true); } else { table.PatronWest = 0; } } }