protected override void OnTarget(Mobile from, object targeted) { if (m_Cotton.Deleted) { return; } ISpinningWheel wheel = targeted as ISpinningWheel; if (wheel == null && targeted is AddonComponent) { wheel = ((AddonComponent)targeted).Addon as ISpinningWheel; } if (wheel is Item) { if (!m_Cotton.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } else if (wheel.Spinning) { from.SendLocalizedMessage(502656); // That spinning wheel is being used. } else { m_Cotton.Consume(); wheel.BeginSpin(new SpinCallback(Cotton.OnSpun), from, m_Cotton.Hue); } } else { from.SendLocalizedMessage(502658); // Use that on a spinning wheel. } }
protected override void OnTarget(Mobile from, object targeted) { if (m_Cotton.Deleted) { return; } ISpinningWheel wheel = targeted as ISpinningWheel; if (wheel == null && targeted is AddonComponent) { wheel = ((AddonComponent)targeted).Addon as ISpinningWheel; } if (wheel is Item) { Item item = (Item)wheel; if (!m_Cotton.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } else if (wheel.Spinning) { from.SendLocalizedMessage(502656); // That spinning wheel is being used. } else { SpinningWheelQuotaAttachment att = (SpinningWheelQuotaAttachment)XmlAttach.FindAttachment(from, typeof(SpinningWheelQuotaAttachment)); if (att == null) { att = new SpinningWheelQuotaAttachment(); XmlAttach.AttachTo(from, att); } if (att.getNumWheels() < SpinningWheelQuotaAttachment.m_WheelQuotaCap) { att.AddWheels(item); from.PublicOverheadMessage(Server.Network.MessageType.Emote, 51, false, "*spinning*"); m_Cotton.Consume(); wheel.BeginSpin(new SpinCallback(Cotton.OnSpunLoop), from, m_Cotton.Hue, m_Cotton); } else { from.SendMessage("You are too occupied with the " + SpinningWheelQuotaAttachment.m_WheelQuotaCap.ToString() + " spinning wheels you are running."); } } } else { from.SendLocalizedMessage(502658); // Use that on a spinning wheel. } }