public static void ForceRedeed(Mobile mobile, BaseHouse house = null) { if (!(mobile is Mannequin) && !(mobile is Steward)) { return; } if (house != null) { List <Item> toAdd = new List <Item>(mobile.Items.Where(i => IsEquipped(i))); if (mobile.Backpack != null) { toAdd.AddRange(mobile.Backpack.Items); } foreach (Item item in toAdd) { house.DropToMovingCrate(item); } if (mobile is Mannequin) { house.DropToMovingCrate(new MannequinDeed()); } else { house.DropToMovingCrate(new StewardDeed()); } } mobile.Delete(); }
public static void ForceRedeed(Mobile mobile, BaseHouse house = null) { if (!(mobile is Mannequin) && !(mobile is Steward)) { return; } if (house != null) { List <Item> toAdd = new List <Item>(mobile.Items.Where(IsEquipped)); if (mobile.Backpack != null) { toAdd.AddRange(mobile.Backpack.Items); } for (var index = 0; index < toAdd.Count; index++) { Item item = toAdd[index]; house.DropToMovingCrate(item); } if (mobile is Mannequin) { house.DropToMovingCrate(new MannequinDeed()); } else { house.DropToMovingCrate(new StewardDeed()); } } mobile.Delete(); }
protected override void OnTick() { BaseHouse house = m_Inventory.House; if (house != null) { if (m_Inventory.Gold > 0) { if (house.MovingCrate == null) { house.MovingCrate = new MovingCrate(house); } Banker.Deposit(house.MovingCrate, m_Inventory.Gold); } foreach (Item item in m_Inventory.Items) { if (!item.Deleted) { house.DropToMovingCrate(item); } } m_Inventory.Gold = 0; m_Inventory.Items.Clear(); } m_Inventory.Delete(); }
protected override void OnTick() { BaseHouse house = m_Inventory.House; if (house != null) { if (m_Inventory.Currency > 0) { if (house.MovingCrate == null) { house.MovingCrate = new MovingCrate(house); } Banker.Deposit(house.MovingCrate, m_Inventory.TypeOfCurrency, m_Inventory.Currency); } foreach (Item item in m_Inventory.Items.Where(item => !item.Deleted)) { house.DropToMovingCrate(item); } m_Inventory.Currency = 0; m_Inventory.Items.Clear(); } m_Inventory.Delete(); }
public void DockBoat(BaseBoat boat, BaseHouse house) { List <ISpawnable> list = boat.GetMovingEntities(); foreach (ISpawnable o in list) { if (!(o is Item) || o == this || boat.IsComponentItem(o) || o is EffectItem || o == boat.TillerMan) { continue; } Item item = o as Item; if (!item.Deleted && boat.Contains(item)) { if (item is AddonComponent || item is BaseAddon) { BaseAddon addon = item is AddonComponent ? ((AddonComponent)item).Addon : (BaseAddon)item; Item deed = addon.Deed; bool retainDeedHue = false; int hue = 0; if (addon != null && addon.RetainDeedHue) { retainDeedHue = true; for (int j = 0; hue == 0 && j < addon.Components.Count; ++j) { AddonComponent c = addon.Components[j]; if (c.Hue != 0) { hue = c.Hue; } } } if (deed != null) { if (retainDeedHue) { deed.Hue = hue; } house.DropToMovingCrate(deed); } } else { item.Delete(); } } Container cont; if (boat is BaseGalleon) { cont = ((BaseGalleon)boat).GalleonHold; } else { cont = boat.Hold; } if (cont != null) { cont.Items.ForEach(i => { if (i is BaseWeapon) { house.DropToMovingCrate(i); } else { i.Delete(); } }); } } BaseDockedBoat model = boat.BoatItem; if (model == null || model.Deleted) { model = boat.DockedBoat; } if (model == null) { return; } model.BoatItem = boat; if (boat.IsClassicBoat && boat.Owner != null) { boat.RemoveKeys(boat.Owner); } house.DropToMovingCrate(model); boat.OnDryDock(); boat.Refresh(); boat.Internalize(); list.Clear(); list.TrimExcess(); }
public void DockBoat(BaseBoat boat, BaseHouse house) { foreach (IEntity entity in boat.GetEntitiesOnBoard()) { if (!(entity is Item) || entity == this || boat.IsComponentItem(entity) || entity is EffectItem || entity == boat.TillerMan) { continue; } Item item = entity as Item; if (!item.Deleted && boat.Contains(item)) { if (item is AddonComponent || item is BaseAddon) { BaseAddon addon = item is AddonComponent component ? component.Addon : (BaseAddon)item; Item deed = addon.Deed; bool retainDeedHue = false; int hue = 0; if (addon.RetainDeedHue) { retainDeedHue = true; for (int j = 0; hue == 0 && j < addon.Components.Count; ++j) { AddonComponent c = addon.Components[j]; if (c.Hue != 0) { hue = c.Hue; } } } if (deed != null) { if (retainDeedHue) { deed.Hue = hue; } house.DropToMovingCrate(deed); } } else { item.Delete(); } } Container cont; if (boat is BaseGalleon galleon) { cont = galleon.GalleonHold; } else { cont = boat.Hold; } if (cont != null) { for (var index = 0; index < cont.Items.Count; index++) { var i = cont.Items[index]; if (i is BaseWeapon) { house.DropToMovingCrate(i); } else { i.Delete(); } } } } BaseDockedBoat model = boat.BoatItem; if (model == null || model.Deleted) { model = boat.DockedBoat; } if (model == null) { return; } model.BoatItem = boat; if (boat.IsClassicBoat && boat.Owner != null) { boat.RemoveKeys(boat.Owner); } house.DropToMovingCrate(model); boat.OnDryDock(null); boat.Refresh(); boat.Internalize(); }