Exemple #1
0
        public void ClearCustomHouseComponents(CUSTOM_HOUSE_MULTI_OBJECT_FLAGS state)
        {
            Item item = World.Items.Get(Serial);

            if (item != null)
            {
                int checkZ = item.Z + 7;

                for (int i = 0; i < Components.Count; i++)
                {
                    Multi component = Components[i];

                    component.State = component.State & ~(CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_TRANSPARENT |
                                                          CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_IGNORE_IN_RENDER |
                                                          CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_VALIDATED_PLACE |
                                                          CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_INCORRECT_PLACE);


                    if (component.IsCustom)
                    {
                        if (component.Z <= item.Z)
                        {
                            if ((component.State & CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_STAIR) == 0)
                            {
                                component.State |= CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_DONT_REMOVE;
                            }
                        }

                        if (state == 0 || (component.State & state) != 0)
                        {
                            component.Destroy();
                        }
                    }
                    else if (component.Z <= checkZ)
                    {
                        component.State = component.State | CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_FLOOR |
                                          CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_IGNORE_IN_RENDER;
                    }

                    if (component.IsDestroyed)
                    {
                        Components.RemoveAt(i--);
                    }
                }
            }
        }
Exemple #2
0
        public void ClearComponents(bool removeCustomOnly = false)
        {
            Item item = World.Items.Get(Serial);

            if (item != null && !item.IsDestroyed)
            {
                item.WantUpdateMulti = true;
            }

            for (int i = 0; i < Components.Count; i++)
            {
                Multi s = Components[i];

                if (!s.IsCustom && removeCustomOnly)
                {
                    continue;
                }

                s.Destroy();
                Components.RemoveAt(i--);
            }

            //Components.Clear();
        }