Esempio n. 1
0
        // Disabled until further understood.
        //	see rule #7 in
        public void Annex(BaseHouse house)
        {
            // because we were annexed, the owner of the new house cannot Demolish it for 7 days
            if (house != null)
            {
                house.SetFlag(ImplFlags.ManagedDemolishion, true);

                if (house.Owner != null)
                {
                    house.Owner.SendMessage("Annexation of another property requires that you keep this house here for at least 7 days.");
                }
            }

            if (m_TentPack != null && this.Owner != null)
            {
                Backpack pack = new Backpack();

                // give them back their tent
                pack.AddItem(new TentBag());

                // Adam: Tents don't follow the rules :\ their regions don't list the mobiles (vendors)
                //	so we'll have to find them via enumeration in the rects of the region
                if (Region.Coords != null && Region.Coords.Count > 0)
                {
                    System.Collections.ArrayList c        = Region.Coords;
                    System.Collections.ArrayList toDelete = new System.Collections.ArrayList();
                    for (int i = 0; i < c.Count; i++)
                    {
                        Rectangle2D rect;
                        rect = (Rectangle2D)c[i];
                        IPooledEnumerable eable;
                        eable = this.Map.GetMobilesInBounds(rect);
                        foreach (object obj in eable)
                        {
                            if (obj is PlayerVendor && (obj as PlayerVendor).Deleted == false && toDelete.Contains(obj) == false)
                            {
                                PlayerVendor pv = obj as PlayerVendor;

                                // give them back the vendor contract
                                pack.AddItem(new ContractOfEmployment());

                                // now give them the gold
                                int hold = pv.HoldGold;
                                pack.AddItem(new Gold(hold));

                                // now give them the loot
                                if (pv.Backpack != null && pv.Backpack.Items.Count > 0)
                                {
                                    for (int ix = 0; ix < pv.Backpack.Items.Count; ix++)
                                    {
                                        Item item = pv.Backpack.Items[0] as Item;
                                        pv.Backpack.RemoveItem(item);
                                        pack.AddItem(item);
                                    }
                                }

                                toDelete.Add(obj);
                            }
                        }

                        eable.Free();
                    }

                    // delete the vendors
                    for (int mx = 0; mx < toDelete.Count; mx++)
                    {
                        if ((toDelete[mx] as PlayerVendor).Deleted == false)
                        {
                            (toDelete[mx] as PlayerVendor).Delete();
                        }
                    }
                }

                // copy the items from the tentpack to the new pack
                if (m_TentPack.Items != null && m_TentPack.Items.Count > 0)
                {
                    while (m_TentPack.Items.Count > 0)
                    {
                        Item item = m_TentPack.Items[0] as Item;
                        m_TentPack.RemoveItem(item);
                        pack.AddItem(item);
                    }
                }

                // save the pack in a safe place
                pack.MoveItemToIntStorage();

                BankBox box = this.Owner.BankBox;
                if (box == null)
                {
                    return;
                }

                box.AddItem(new TentReimbursementDeed(pack));

                this.Owner.SendMessage("By decree of Lord British, your tent has been annexed.");
                this.Owner.SendMessage("You may recover your belongings by redeeming the deed in your bankbox.");

                this.Delete();
            }
        }