private void OnConfirmCallback(Mobile from, bool okay, object state) { object[] states = (object[])state; CommandEventArgs e = (CommandEventArgs)states[0]; ArrayList list = (ArrayList)states[1]; bool staticsOnly = (bool)states[2]; bool flushToLog = false; if (okay) { List <HouseFoundation> foundations = new List <HouseFoundation>(); flushToLog = list.Count > 20; for (int i = 0; i < list.Count; ++i) { HouseFoundation house; DesignInsertResult result = ProcessInsert(list[i] as Item, staticsOnly, out house); switch (result) { case DesignInsertResult.Valid: { AddResponse("The item has been inserted into the house design."); if (!foundations.Contains(house)) { foundations.Add(house); } break; } case DesignInsertResult.InvalidItem: { LogFailure("That cannot be inserted."); break; } case DesignInsertResult.NotInHouse: case DesignInsertResult.OutsideHouseBounds: { LogFailure("That item is not inside a customizable house."); break; } } } foreach (HouseFoundation house in foundations) { house.Delta(ItemDelta.Update); } } else { AddResponse("Command aborted."); } Flush(from, flushToLog); }
protected override void OnTarget(Mobile from, object obj) { DesignInsertResult result = ProcessInsert(obj as Item, m_StaticsOnly, out HouseFoundation house); switch (result) { case DesignInsertResult.Valid: { if (m_Foundations.Count == 0) { from.SendMessage( "The item has been inserted into the house design. Press ESC when you are finished."); } else { from.SendMessage("The item has been inserted into the house design."); } if (!m_Foundations.Contains(house)) { m_Foundations.Add(house); } break; } case DesignInsertResult.InvalidItem: { from.SendMessage("That cannot be inserted. Try again."); break; } case DesignInsertResult.NotInHouse: case DesignInsertResult.OutsideHouseBounds: { from.SendMessage("That item is not inside a customizable house. Try again."); break; } } from.Target = new DesignInsertTarget(m_Foundations, m_StaticsOnly); }