Example #1
0
        protected override void OnTarget(Mobile from, object targeted)
        {
            IPoint3D p   = targeted as IPoint3D;
            Map      map = from.Map;

            if (p == null || map == null || m_Maker == null || m_Maker.Deleted)
            {
                return;
            }

            if (m_Maker.IsChildOf(from.Backpack))
            {
                SpellHelper.GetSurfaceTop(ref p);
                BaseHouse house = null;
                Point3D   loc   = new Point3D(p);

                AddonFitResult result = CouldFit(loc, map, from, ref house);

                if (result == AddonFitResult.Valid)
                {
                    CharacterStatue       statue = new CharacterStatue(from, m_Type);
                    CharacterStatuePlinth plinth = new CharacterStatuePlinth(statue);

                    house.Addons.Add(plinth);

                    statue.Plinth = plinth;
                    plinth.MoveToWorld(loc, map);
                    statue.InvalidatePose();

                    from.SendGump(new CharacterStatueGump(m_Maker, statue));
                }
                else if (result == AddonFitResult.Blocked)
                {
                    from.SendLocalizedMessage(500269);                       // You cannot build that there.
                }
                else if (result == AddonFitResult.NotInHouse)
                {
                    from.SendLocalizedMessage(1076192);                       // Statues can only be placed in houses where you are the owner or co-owner.
                }
                else if (result == AddonFitResult.DoorsNotClosed)
                {
                    from.SendMessage("You must close all house doors before placing this.");
                }
                else if (result == AddonFitResult.DoorTooClose)
                {
                    from.SendLocalizedMessage(500271);                       // You cannot build near the door.
                }
            }
            else
            {
                from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
            }
        }
Example #2
0
        public override void OnResponse(GameClient state, RelayInfo info)
        {
            if (m_Statue == null || m_Statue.Deleted)
            {
                return;
            }

            bool sendGump = false;

            if (info.ButtonID == (int)Buttons.Sculpt)
            {
                if (m_Maker is CharacterStatueDeed)
                {
                    CharacterStatue backup = ((CharacterStatueDeed)m_Maker).Statue;

                    if (backup != null)
                    {
                        backup.Delete();
                    }
                }

                if (m_Maker != null)
                {
                    m_Maker.Delete();
                }

                m_Statue.Sculpt(state.Mobile);
            }
            else if (info.ButtonID == (int)Buttons.PosePrev)
            {
                m_Statue.Pose = (StatuePose)(((int)m_Statue.Pose + 5) % 6);
                sendGump      = true;
            }
            else if (info.ButtonID == (int)Buttons.PoseNext)
            {
                m_Statue.Pose = (StatuePose)(((int)m_Statue.Pose + 1) % 6);
                sendGump      = true;
            }
            else if (info.ButtonID == (int)Buttons.DirPrev)
            {
                m_Statue.Direction = (Direction)(((int)m_Statue.Direction + 7) % 8);
                m_Statue.InvalidatePose();
                sendGump = true;
            }
            else if (info.ButtonID == (int)Buttons.DirNext)
            {
                m_Statue.Direction = (Direction)(((int)m_Statue.Direction + 1) % 8);
                m_Statue.InvalidatePose();
                sendGump = true;
            }
            else if (info.ButtonID == (int)Buttons.MatPrev)
            {
                m_Statue.Material = (StatueMaterial)(((int)m_Statue.Material + 3) % 4);
                sendGump          = true;
            }
            else if (info.ButtonID == (int)Buttons.MatNext)
            {
                m_Statue.Material = (StatueMaterial)(((int)m_Statue.Material + 1) % 4);
                sendGump          = true;
            }
            else if (info.ButtonID == (int)Buttons.Restore)
            {
                if (m_Maker is CharacterStatueDeed)
                {
                    CharacterStatue backup = ((CharacterStatueDeed)m_Maker).Statue;

                    if (backup != null)
                    {
                        m_Statue.Restore(backup);
                    }
                }

                sendGump = true;
            }
            else
            {
                m_Statue.Delete();
            }

            if (sendGump)
            {
                state.Mobile.SendGump(new CharacterStatueGump(m_Maker, m_Statue, m_Owner));
            }

            if (m_Timer != null)
            {
                m_Timer.Stop();
            }
        }
Example #3
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (m_Statue == null || m_Statue.Deleted)
            {
                return;
            }

            bool sendGump = false;

            bool hasmat = m_Statue.StatueType <= StatueType.Bronze;

            if (info.ButtonID == (int)Buttons.Sculpt)
            {
                if (m_Backup != null)
                {
                    m_Backup.Delete();
                }

                m_Statue.Sculpt(state.Mobile);
            }
            else if (info.ButtonID == (int)Buttons.PosePrev)
            {
                m_Statue.Pose = (StatuePose)(((int)m_Statue.Pose + 5) % 6);
                sendGump      = true;
            }
            else if (info.ButtonID == (int)Buttons.PoseNext)
            {
                m_Statue.Pose = (StatuePose)(((int)m_Statue.Pose + 1) % 6);
                sendGump      = true;
            }
            else if (info.ButtonID == (int)Buttons.DirPrev)
            {
                m_Statue.Direction = (Direction)(((int)m_Statue.Direction + 7) % 8);
                m_Statue.InvalidatePose();
                sendGump = true;
            }
            else if (info.ButtonID == (int)Buttons.DirNext)
            {
                m_Statue.Direction = (Direction)(((int)m_Statue.Direction + 1) % 8);
                m_Statue.InvalidatePose();
                sendGump = true;
            }
            else if (hasmat && info.ButtonID == (int)Buttons.MatPrev)
            {
                m_Statue.Material = (StatueMaterial)(((int)m_Statue.Material + 3) % 4);
                sendGump          = true;
            }
            else if (hasmat && info.ButtonID == (int)Buttons.MatNext)
            {
                m_Statue.Material = (StatueMaterial)(((int)m_Statue.Material + 1) % 4);
                sendGump          = true;
            }
            else if (info.ButtonID == (int)Buttons.Restore)
            {
                if (m_Backup != null)
                {
                    m_Statue.Restore(m_Backup);
                }
                else
                {
                    m_Owner.SendMessage("No restoration available.");
                }

                sendGump = true;
            }
            else
            {
                CloseGump();
            }

            if (sendGump)
            {
                state.Mobile.SendGump(new CharacterStatueGump(m_Statue, m_Owner, m_Backup));
            }

            if (m_Timer != null)
            {
                m_Timer.Stop();
            }
        }