public override void Deserialize(GenericReader reader) { base.Deserialize(reader); /*int version = */ reader.ReadInt(); m_BirthDate = reader.ReadDateTime(); m_Perch = reader.ReadItem() as ParrotPerchAddon; }
protected override void OnTarget(Mobile from, object targeted) { if (m_Parrot == null || m_Parrot.Deleted) { return; } ParrotPerchAddon perch = null; if (targeted is ParrotPerchAddon) { perch = targeted as ParrotPerchAddon; } else if (targeted is ParrotPerchAddonComponent) { perch = ((ParrotPerchAddonComponent)targeted).Addon as ParrotPerchAddon; } if (perch != null) { BaseHouse h = perch.MyHouse; if (h == null || (h.Owner != from && !h.CoOwners.Contains(from))) { from.SendLocalizedMessage(1072618); // Parrots can only be placed on Parrot Perches in houses where you are an owner or co-owner. } else if (perch.Parrot != null) { from.SendLocalizedMessage(1072616); // That Parrot Perch already has a Parrot. } else { Parrot parrot = new Parrot(m_Parrot.Hue); parrot.MoveToWorld(new Point3D(perch.Location.X, perch.Location.Y, perch.Location.Z + 11), perch.Map); perch.Parrot = parrot; parrot.Perch = perch; m_Parrot.Delete(); } } else { from.SendLocalizedMessage(1072614); // You must place the Parrot on a Parrot Perch. } }
protected override void OnTarget(Mobile from, object targeted) { IPoint3D p = targeted as IPoint3D; Map map = from.Map; if (p == null || map == null || m_Deed.Deleted) { return; } if (m_Deed.IsChildOf(from.Backpack)) { ParrotPerchAddon addon = m_Deed.Addon as ParrotPerchAddon; Server.Spells.SpellHelper.GetSurfaceTop(ref p); ArrayList houses = null; AddonFitResult res = addon.CouldFit(p, map, from, ref houses); if (res == AddonFitResult.Valid) { addon.MoveToWorld(new Point3D(p), map); } else if (res == AddonFitResult.Blocked) { from.SendLocalizedMessage(500269); // You cannot build that there. } else if (res == AddonFitResult.NotInHouse) { from.SendLocalizedMessage(500274); // You can only place this in a house that you own! } else if (res == AddonFitResult.DoorsNotClosed) { from.SendMessage("You must close all house doors before placing this."); } else if (res == AddonFitResult.DoorTooClose) { from.SendLocalizedMessage(500271); // You cannot build near the door. } else if (res == AddonFitResult.NoWall) { from.SendLocalizedMessage(500268); // This object needs to be mounted on something. } if (res == AddonFitResult.Valid) { if (houses != null) { foreach (BaseHouse h in houses) { h.Addons.Add(addon); addon.MyHouse = h; } if (m_Deed.m_ContainsParrot) { Parrot parrot = new Parrot(m_Deed.m_ParrotName, m_Deed.m_ParrotHue, m_Deed.m_ParrotBirthDate); parrot.MoveToWorld(new Point3D(addon.Location.X, addon.Location.Y, addon.Location.Z + 11), addon.Map); addon.Parrot = parrot; parrot.Perch = addon; } } m_Deed.Delete(); } else { addon.Delete(); } } else { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } }