public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            bool CanBeUsed = SGCore.SGSystemEnabled;
            bool BeingUsed = false;
            bool Energy = false;
            bool HideAdd = SGCore.SGSystemHideGate;
            string DiscoverName = "NooneYet"; // Just a temp filler (Avoid a null string)

            // Get value contained in the text input box
            string sgplatname = GetString(info, 21);

            switch (info.ButtonID)
            {
                case 1:
                    {
                        from.CloseGump(typeof(SGGumpAdministrator));
                        sgaddonid = sgaddonid - 1;
                        if (sgaddonid <= 1)
                        {
                            sgaddonid = 1;
                        }
                        from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5));
                    }
                    break;

                case 2:
                    {
                        from.CloseGump(typeof(SGGumpAdministrator));
                        sgaddonid = sgaddonid + 1;
                        if (sgaddonid >= SGCore.SGAddonStyles)
                        {
                            sgaddonid = SGCore.SGAddonStyles;
                        }
                        from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5));
                    }
                    break;

                case 3:
                    {
                        from.CloseGump(typeof(SGGumpAdministrator));
                        if (sgdir == "East")
                        {
                            sgdir = "S";
                        }
                        from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5));
                    }
                    break;

                case 4:
                    {
                        from.CloseGump(typeof(SGGumpAdministrator));
                        if (sgdir == "South")
                        {
                            sgdir = "E";
                        }
                        from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5));
                    }
                    break;

                case 5:
                    {
                        from.CloseGump(typeof(SGGumpAdministrator));
                        addcode1 = addcode1 - 1;
                        if (addcode1 <= 1)
                        {
                            addcode1 = 1;
                        }
                        from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5));
                    }
                    break;

                case 6:
                    {
                        from.CloseGump(typeof(SGGumpAdministrator));
                        addcode1 = addcode1 + 1;
                        if (addcode1 >= 5)
                        {
                            addcode1 = 5;
                        }
                        from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5));
                    }
                    break;

                case 7:
                    {
                        from.CloseGump(typeof(SGGumpAdministrator));
                        addcode2 = addcode2 - 1;
                        if (addcode2 <= 1)
                        {
                            addcode2 = 1;
                        }
                        from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5));
                    }
                    break;

                case 8:
                    {
                        from.CloseGump(typeof(SGGumpAdministrator));
                        addcode2 = addcode2 + 1;
                        if (addcode2 >= 5)
                        {
                            addcode2 = 5;
                        }
                        from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5));
                    }
                    break;

                case 9:
                    {
                        from.CloseGump(typeof(SGGumpAdministrator));
                        addcode3 = addcode3 - 1;
                        if (addcode3 <= 1)
                        {
                            addcode3 = 1;
                        }
                        from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5));
                    }
                    break;

                case 10:
                    {
                        from.CloseGump(typeof(SGGumpAdministrator));
                        addcode3 = addcode3 + 1;
                        if (addcode3 >= 5)
                        {
                            addcode3 = 5;
                        }
                        from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5));
                    }
                    break;

                case 11:
                    {
                        from.CloseGump(typeof(SGGumpAdministrator));
                        addcode4 = addcode4 - 1;
                        if (addcode4 <= 1)
                        {
                            addcode4 = 1;
                        }
                        from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5));
                    }
                    break;

                case 12:
                    {
                        from.CloseGump(typeof(SGGumpAdministrator));
                        addcode4 = addcode4 + 1;
                        if (addcode4 >= 5)
                        {
                            addcode4 = 5;
                        }
                        from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5));
                    }
                    break;

                case 13:
                    {
                        from.CloseGump(typeof(SGGumpAdministrator));
                        addcode5 = addcode5 - 1;
                        if (addcode5 <= 1)
                        {
                            addcode5 = 1;
                        }
                        from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5));
                    }
                    break;

                case 14:
                    {
                        from.CloseGump(typeof(SGGumpAdministrator));
                        addcode5 = addcode5 + 1;
                        if (addcode5 >= 5)
                        {
                            addcode5 = 5;
                        }
                        from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5));
                    }
                    break;

                case 15:
                    {
                        from.CloseGump(typeof(SGGumpAdministrator));

                        bool dupedgate = false;

                        // Check which map the person adding a gate is actually on
                        string whichmap = Convert.ToString(from.Map);
                        if (whichmap == "Felucca")
                        {
                            facetid = 1;
                        }
                        if (whichmap == "Trammel")
                        {
                            facetid = 2;
                        }
                        if (whichmap == "Ilshenar")
                        {
                            facetid = 3;
                        }
                        if (whichmap == "Malas")
                        {
                            facetid = 4;
                        }
                        if (whichmap == "Tokuno")
                        {
                            facetid = 5;
                        }

                        // Check for duplicated addresses in the array
                        for (int i = 0; i < SGCore.SGList.Count; i++)
                        {
                            SGEntry sge = (SGEntry)SGCore.SGList[i];
                            {
                                if (sge.SGFacetCode == facetid && sge.SGAddressCode1 == addcode1 && sge.SGAddressCode2 == addcode2 && sge.SGAddressCode3 == addcode3 && sge.SGAddressCode4 == addcode4 && sge.SGAddressCode5 == addcode5)
                                {
                                    dupedgate = true;
                                }
                            }
                        }

                        if (!dupedgate)
                        {

                            if (sgdir == "South" && sgaddonid ==1)
                            {
                                sgdir = "S";
                                Item SGASouth = new SGLocationAddon1South();
                                SGASouth.MoveToWorld(new Point3D(from.X, from.Y, from.Z), from.Map);
                            }
                            if (sgdir == "East" && sgaddonid == 1)
                            {
                                sgdir = "E";
                                Item SGAEast = new SGLocationAddon1East();
                                SGAEast.MoveToWorld(new Point3D(from.X, from.Y, from.Z), from.Map);
                            }

                            if (sgdir == "South" && sgaddonid == 2)
                            {
                                sgdir = "S";
                                Item SGASouth = new SGLocationAddon2South();
                                SGASouth.MoveToWorld(new Point3D(from.X, from.Y, from.Z), from.Map);
                            }
                            if (sgdir == "East" && sgaddonid == 2)
                            {
                                sgdir = "E";
                                Item SGAEast = new SGLocationAddon2East();
                                SGAEast.MoveToWorld(new Point3D(from.X, from.Y, from.Z), from.Map);
                            }

                            if (sgdir == "South" && sgaddonid == 3)
                            {
                                sgdir = "S";
                                Item SGASouth = new SGLocationAddon3South();
                                SGASouth.MoveToWorld(new Point3D(from.X, from.Y, from.Z), from.Map);
                            }
                            if (sgdir == "East" && sgaddonid == 3)
                            {
                                sgdir = "E";
                                Item SGAEast = new SGLocationAddon3East();
                                SGAEast.MoveToWorld(new Point3D(from.X, from.Y, from.Z), from.Map);
                            }

                            Item SGACrystal = new SGActivatorDevice(from.X, from.Y, from.Z, sgdir, sgaddonid, CanBeUsed, BeingUsed, Energy, HideAdd, DiscoverName, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5);
                            SGACrystal.MoveToWorld(new Point3D(from.X + 1, from.Y + 4, from.Z +1), from.Map);
                            SGCore.SGList.Add(new SGEntry(from.X, from.Y, from.Z, sgdir, sgaddonid, SGCore.SGSystemEnabled, false, false, SGCore.SGSystemHideGate, "Nobody", sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5));
                            from.Z = from.Z + 6;
                            from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5));

                            if (!SGCore.SGSystemEnabled)
                            {
                                for (int i = 0; i < SGCore.SGList.Count; i++)
                                {
                                    SGEntry sge = (SGEntry)SGCore.SGList[i];
                                    {
                                        sge.SGCanBeUsed = false;
                                        sge.SGBeingUsed = false;
                                        sge.SGEnergy = false;
                                    }
                                }
                                // Hue Control Crystals To DISABLED
                                ArrayList SGADevice = new ArrayList();
                                foreach (Item item in World.Items.Values)
                                {
                                    if (item is SGActivatorDevice)
                                        SGADevice.Add(item);
                                }

                                foreach (Item item in SGADevice)
                                    (item).Hue = 0;
                            }
                            else if (SGCore.SGSystemEnabled)
                            {
                                for (int i = 0; i < SGCore.SGList.Count; i++)
                                {
                                    SGEntry sge = (SGEntry)SGCore.SGList[i];
                                    {
                                        sge.SGCanBeUsed = true;
                                        sge.SGBeingUsed = false;
                                        sge.SGEnergy = false;
                                    }
                                }
                                // Hue Control Crystals To ENABLED
                                ArrayList SGADevice = new ArrayList();
                                foreach (Item item in World.Items.Values)
                                {
                                    if (item is SGActivatorDevice)
                                        SGADevice.Add(item);
                                }

                                foreach (Item item in SGADevice)
                                    (item).Hue = 0;
                            }
                        }
                        else
                        {
                            // duped gate address
                            from.SendMessage(88, "ABORTED !!!, This gate address is already used on this facet, Try a different address for your gate.");
                            from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5));
                        }
                    }
                    break;

                case 16:
                    {
                        from.CloseGump(typeof(SGGumpAdministrator));

                        if (!SGCore.SGSystemEnabled)
                        {
                            SGCore.SGSystemEnabled = true;
                            from.SendMessage(77, "Gate System enabled.");
                            for (int i = 0; i < SGCore.SGList.Count; i++)
                            {
                                SGEntry sge = (SGEntry)SGCore.SGList[i];
                                {
                                    sge.SGCanBeUsed = true;
                                    sge.SGBeingUsed = false;
                                    sge.SGEnergy = false;
                                }
                            }
                            // Hue Control Crystals To NORMAL
                            ArrayList SGADevice = new ArrayList();
                            foreach (Item item in World.Items.Values)
                            {
                                if (item is SGActivatorDevice)
                                    SGADevice.Add(item);
                            }

                            foreach (Item item in SGADevice)
                                (item).Hue = 0;
                        }
                        else
                        {
                            SGCore.SGSystemEnabled = false;
                            from.SendMessage(77, "Gate System disabled, any open gates will close down after they are used.");
                            for (int i = 0; i < SGCore.SGList.Count; i++)
                            {
                                SGEntry sge = (SGEntry)SGCore.SGList[i];
                                {
                                    sge.SGCanBeUsed = false;
                                    sge.SGBeingUsed = false;
                                    sge.SGEnergy = false;
                                }
                            }
                            // Hue Control Crystals To DISABLED
                            ArrayList SGADevice = new ArrayList();
                            foreach (Item item in World.Items.Values)
                            {
                                if (item is SGActivatorDevice)
                                    SGADevice.Add(item);
                            }

                            foreach (Item item in SGADevice)
                                (item).Hue = 0;
                        }
                        from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5));
                    }
                    break;
                case 17:
                    {
                        from.CloseGump(typeof(SGGumpAdministrator));
                        from.SendMessage(77, "Saving XML File, Overwriting old XML file...");
                        SGCore.SGTriggerSave();
                        from.SendMessage(77, "Save Done.");
                        from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5));
                    }
                    break;

                case 18:
                    {
                        from.CloseGump(typeof(SGGumpAdministrator));
                        SGCore.SGTriggerLoad();
                        from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5));
                    }
                    break;

                case 19:
                    {
                        from.SendMessage(77, "Exit Gate Admin");
                        from.CloseGump(typeof(SGGumpAdministrator));
                    }
                    break;

                case 20:
                    {
                        from.SendMessage(77, "Administrator Help & Information Option Selected...");

                        from.CloseGump(typeof(SGGumpAdministrator));
                        from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5));
                    }
                    break;

                case 21:
                    {
                        from.CloseGump(typeof(SGGumpAdministrator));

                        from.SendMessage(77, "Generate HTML Address File...");
                        SGCore.SGGenHTML();
                        from.SendMessage(77, "Done.");

                        from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5));
                    }
                    break;
            }
        }
Пример #2
0
        public static void SGWorldBuild()
        {
            if (SGList.Count <= 0)
            {
                Utility.PushColor(ConsoleColor.White);
                Console.Write("Gate System : ");
                Utility.PopColor();
                Utility.PushColor(ConsoleColor.Green);
                Console.WriteLine("No Gates To Build.");
                Utility.PopColor();
            }
            else
            {
                Utility.PushColor(ConsoleColor.White);
                Console.Write("Gate System : ");
                Utility.PopColor();
                Utility.PushColor(ConsoleColor.Green);
                Console.WriteLine("Building {0} Gates...", SGList.Count);
                Utility.PopColor();

                for (int i = 0; i < SGList.Count; i++)
                {

                    SGEntry sgwb = (SGEntry)SGList[i];

                    // ********************************************
                    // *** Check Style And Direction of Platform **
                    // ********************************************
                    if (sgwb.SGStyle == 1)
                    {
                        if (sgwb.SGFacing == "E")
                        {
                            if (sgwb.SGFacetCode == 1)
                            {
                                Item platform = new SGLocationAddon1East();
                                platform.MoveToWorld(new Point3D(sgwb.SGX, sgwb.SGY, sgwb.SGZ), Map.Felucca);
                            }
                            else if (sgwb.SGFacetCode == 2)
                            {
                                Item platform = new SGLocationAddon1East();
                                platform.MoveToWorld(new Point3D(sgwb.SGX, sgwb.SGY, sgwb.SGZ), Map.Trammel);
                            }
                            else if (sgwb.SGFacetCode == 3)
                            {
                                Item platform = new SGLocationAddon1East();
                                platform.MoveToWorld(new Point3D(sgwb.SGX, sgwb.SGY, sgwb.SGZ), Map.Ilshenar);
                            }
                            else if (sgwb.SGFacetCode == 4)
                            {
                                Item platform = new SGLocationAddon1East();
                                platform.MoveToWorld(new Point3D(sgwb.SGX, sgwb.SGY, sgwb.SGZ), Map.Malas);
                            }
                            else if (sgwb.SGFacetCode == 5)
                            {
                                Item platform = new SGLocationAddon1East();
                                platform.MoveToWorld(new Point3D(sgwb.SGX, sgwb.SGY, sgwb.SGZ), Map.Tokuno);
                            }
                        }
                        else
                        {
                            if (sgwb.SGFacetCode == 1)
                            {
                                Item platform = new SGLocationAddon1South();
                                platform.MoveToWorld(new Point3D(sgwb.SGX, sgwb.SGY, sgwb.SGZ), Map.Felucca);
                            }
                            else if (sgwb.SGFacetCode == 2)
                            {
                                Item platform = new SGLocationAddon1South();
                                platform.MoveToWorld(new Point3D(sgwb.SGX, sgwb.SGY, sgwb.SGZ), Map.Trammel);
                            }
                            else if (sgwb.SGFacetCode == 3)
                            {
                                Item platform = new SGLocationAddon1South();
                                platform.MoveToWorld(new Point3D(sgwb.SGX, sgwb.SGY, sgwb.SGZ), Map.Ilshenar);
                            }
                            else if (sgwb.SGFacetCode == 4)
                            {
                                Item platform = new SGLocationAddon1South();
                                platform.MoveToWorld(new Point3D(sgwb.SGX, sgwb.SGY, sgwb.SGZ), Map.Malas);
                            }
                            else if (sgwb.SGFacetCode == 5)
                            {
                                Item platform = new SGLocationAddon1South();
                                platform.MoveToWorld(new Point3D(sgwb.SGX, sgwb.SGY, sgwb.SGZ), Map.Tokuno);
                            }
                        }
                    }

                    if (sgwb.SGStyle == 2)
                    {
                        if (sgwb.SGFacing == "E")
                        {
                            if (sgwb.SGFacetCode == 1)
                            {
                                Item platform = new SGLocationAddon2East();
                                platform.MoveToWorld(new Point3D(sgwb.SGX, sgwb.SGY, sgwb.SGZ), Map.Felucca);
                            }
                            else if (sgwb.SGFacetCode == 2)
                            {
                                Item platform = new SGLocationAddon2East();
                                platform.MoveToWorld(new Point3D(sgwb.SGX, sgwb.SGY, sgwb.SGZ), Map.Trammel);
                            }
                            else if (sgwb.SGFacetCode == 3)
                            {
                                Item platform = new SGLocationAddon2East();
                                platform.MoveToWorld(new Point3D(sgwb.SGX, sgwb.SGY, sgwb.SGZ), Map.Ilshenar);
                            }
                            else if (sgwb.SGFacetCode == 4)
                            {
                                Item platform = new SGLocationAddon2East();
                                platform.MoveToWorld(new Point3D(sgwb.SGX, sgwb.SGY, sgwb.SGZ), Map.Malas);
                            }
                            else if (sgwb.SGFacetCode == 5)
                            {
                                Item platform = new SGLocationAddon2East();
                                platform.MoveToWorld(new Point3D(sgwb.SGX, sgwb.SGY, sgwb.SGZ), Map.Tokuno);
                            }
                        }
                        else
                        {
                            if (sgwb.SGFacetCode == 1)
                            {
                                Item platform = new SGLocationAddon2South();
                                platform.MoveToWorld(new Point3D(sgwb.SGX, sgwb.SGY, sgwb.SGZ), Map.Felucca);
                            }
                            else if (sgwb.SGFacetCode == 2)
                            {
                                Item platform = new SGLocationAddon2South();
                                platform.MoveToWorld(new Point3D(sgwb.SGX, sgwb.SGY, sgwb.SGZ), Map.Trammel);
                            }
                            else if (sgwb.SGFacetCode == 3)
                            {
                                Item platform = new SGLocationAddon2South();
                                platform.MoveToWorld(new Point3D(sgwb.SGX, sgwb.SGY, sgwb.SGZ), Map.Ilshenar);
                            }
                            else if (sgwb.SGFacetCode == 4)
                            {
                                Item platform = new SGLocationAddon2South();
                                platform.MoveToWorld(new Point3D(sgwb.SGX, sgwb.SGY, sgwb.SGZ), Map.Malas);
                            }
                            else if (sgwb.SGFacetCode == 5)
                            {
                                Item platform = new SGLocationAddon2South();
                                platform.MoveToWorld(new Point3D(sgwb.SGX, sgwb.SGY, sgwb.SGZ), Map.Tokuno);
                            }
                        }
                    }

                    if (sgwb.SGStyle == 3)
                    {
                        if (sgwb.SGFacing == "E")
                        {
                            if (sgwb.SGFacetCode == 1)
                            {
                                Item platform = new SGLocationAddon3East();
                                platform.MoveToWorld(new Point3D(sgwb.SGX, sgwb.SGY, sgwb.SGZ), Map.Felucca);
                            }
                            else if (sgwb.SGFacetCode == 2)
                            {
                                Item platform = new SGLocationAddon3East();
                                platform.MoveToWorld(new Point3D(sgwb.SGX, sgwb.SGY, sgwb.SGZ), Map.Trammel);
                            }
                            else if (sgwb.SGFacetCode == 3)
                            {
                                Item platform = new SGLocationAddon3East();
                                platform.MoveToWorld(new Point3D(sgwb.SGX, sgwb.SGY, sgwb.SGZ), Map.Ilshenar);
                            }
                            else if (sgwb.SGFacetCode == 4)
                            {
                                Item platform = new SGLocationAddon3East();
                                platform.MoveToWorld(new Point3D(sgwb.SGX, sgwb.SGY, sgwb.SGZ), Map.Malas);
                            }
                            else if (sgwb.SGFacetCode == 5)
                            {
                                Item platform = new SGLocationAddon3East();
                                platform.MoveToWorld(new Point3D(sgwb.SGX, sgwb.SGY, sgwb.SGZ), Map.Tokuno);
                            }
                        }
                        else
                        {
                            if (sgwb.SGFacetCode == 1)
                            {
                                Item platform = new SGLocationAddon3South();
                                platform.MoveToWorld(new Point3D(sgwb.SGX, sgwb.SGY, sgwb.SGZ), Map.Felucca);
                            }
                            else if (sgwb.SGFacetCode == 2)
                            {
                                Item platform = new SGLocationAddon3South();
                                platform.MoveToWorld(new Point3D(sgwb.SGX, sgwb.SGY, sgwb.SGZ), Map.Trammel);
                            }
                            else if (sgwb.SGFacetCode == 3)
                            {
                                Item platform = new SGLocationAddon3South();
                                platform.MoveToWorld(new Point3D(sgwb.SGX, sgwb.SGY, sgwb.SGZ), Map.Ilshenar);
                            }
                            else if (sgwb.SGFacetCode == 4)
                            {
                                Item platform = new SGLocationAddon3South();
                                platform.MoveToWorld(new Point3D(sgwb.SGX, sgwb.SGY, sgwb.SGZ), Map.Malas);
                            }
                            else if (sgwb.SGFacetCode == 5)
                            {
                                Item platform = new SGLocationAddon3South();
                                platform.MoveToWorld(new Point3D(sgwb.SGX, sgwb.SGY, sgwb.SGZ), Map.Tokuno);
                            }
                        }
                    }
                    // ********************************************
                    // * Add Crystal Control Device For This Gate *
                    // ********************************************
                    if (sgwb.SGFacetCode == 1)
                    {
                        Item SGACrystal = new SGActivatorDevice(sgwb.SGX, sgwb.SGY, sgwb.SGZ, sgwb.SGFacing, sgwb.SGStyle, sgwb.SGCanBeUsed, sgwb.SGBeingUsed, sgwb.SGEnergy, sgwb.SGHidden, sgwb.SGDiscovered, sgwb.SGLocationName, sgwb.SGFacetCode, sgwb.SGAddressCode1, sgwb.SGAddressCode2, sgwb.SGAddressCode3, sgwb.SGAddressCode4, sgwb.SGAddressCode5);
                        SGACrystal.MoveToWorld(new Point3D(sgwb.SGX + 1, sgwb.SGY + 4, sgwb.SGZ + 1), Map.Felucca);
                    }
                    else if (sgwb.SGFacetCode == 2)
                    {
                        Item SGACrystal = new SGActivatorDevice(sgwb.SGX, sgwb.SGY, sgwb.SGZ, sgwb.SGFacing, sgwb.SGStyle, sgwb.SGCanBeUsed, sgwb.SGBeingUsed, sgwb.SGEnergy, sgwb.SGHidden, sgwb.SGDiscovered, sgwb.SGLocationName, sgwb.SGFacetCode, sgwb.SGAddressCode1, sgwb.SGAddressCode2, sgwb.SGAddressCode3, sgwb.SGAddressCode4, sgwb.SGAddressCode5);
                        SGACrystal.MoveToWorld(new Point3D(sgwb.SGX + 0, sgwb.SGY + 4, sgwb.SGZ), Map.Trammel);
                    }
                    else if (sgwb.SGFacetCode == 3)
                    {
                        Item SGACrystal = new SGActivatorDevice(sgwb.SGX, sgwb.SGY, sgwb.SGZ, sgwb.SGFacing, sgwb.SGStyle, sgwb.SGCanBeUsed, sgwb.SGBeingUsed, sgwb.SGEnergy, sgwb.SGHidden, sgwb.SGDiscovered, sgwb.SGLocationName, sgwb.SGFacetCode, sgwb.SGAddressCode1, sgwb.SGAddressCode2, sgwb.SGAddressCode3, sgwb.SGAddressCode4, sgwb.SGAddressCode5);
                        SGACrystal.MoveToWorld(new Point3D(sgwb.SGX + 0, sgwb.SGY + 4, sgwb.SGZ), Map.Ilshenar);
                    }
                    else if (sgwb.SGFacetCode == 4)
                    {
                        Item SGACrystal = new SGActivatorDevice(sgwb.SGX, sgwb.SGY, sgwb.SGZ, sgwb.SGFacing, sgwb.SGStyle, sgwb.SGCanBeUsed, sgwb.SGBeingUsed, sgwb.SGEnergy, sgwb.SGHidden, sgwb.SGDiscovered, sgwb.SGLocationName, sgwb.SGFacetCode, sgwb.SGAddressCode1, sgwb.SGAddressCode2, sgwb.SGAddressCode3, sgwb.SGAddressCode4, sgwb.SGAddressCode5);
                        SGACrystal.MoveToWorld(new Point3D(sgwb.SGX + 0, sgwb.SGY + 4, sgwb.SGZ), Map.Malas);
                    }
                    else if (sgwb.SGFacetCode == 5)
                    {
                        Item SGACrystal = new SGActivatorDevice(sgwb.SGX, sgwb.SGY, sgwb.SGZ, sgwb.SGFacing, sgwb.SGStyle, sgwb.SGCanBeUsed, sgwb.SGBeingUsed, sgwb.SGEnergy, sgwb.SGHidden, sgwb.SGDiscovered, sgwb.SGLocationName, sgwb.SGFacetCode, sgwb.SGAddressCode1, sgwb.SGAddressCode2, sgwb.SGAddressCode3, sgwb.SGAddressCode4, sgwb.SGAddressCode5);
                        SGACrystal.MoveToWorld(new Point3D(sgwb.SGX + 0, sgwb.SGY + 4, sgwb.SGZ), Map.Tokuno);
                    }
                }
                // Put correct HUE to Crystals built, System Enabled or Disabled
                if (!SGCore.SGSystemEnabled)
                {
                    // System is Disabled
                    for (int i = 0; i < SGCore.SGList.Count; i++)
                    {
                        SGEntry sge = (SGEntry)SGCore.SGList[i];
                        {
                            sge.SGCanBeUsed = false;
                            sge.SGBeingUsed = false;
                            sge.SGEnergy = false;
                        }
                    }
                    // Hue Control Crystals To DISABLED
                    ArrayList SGADevice = new ArrayList();
                    foreach (Item item in World.Items.Values)
                    {
                        if (item is SGActivatorDevice)
                            SGADevice.Add(item);
                    }

                    foreach (Item item in SGADevice)
                        (item).Hue = 0;
                }
                else if (SGCore.SGSystemEnabled)
                {
                    // System is Enabled
                    for (int i = 0; i < SGCore.SGList.Count; i++)
                    {
                        SGEntry sge = (SGEntry)SGCore.SGList[i];
                        {
                            sge.SGCanBeUsed = true;
                            sge.SGBeingUsed = false;
                            sge.SGEnergy = false;
                        }
                    }
                    // Hue Control Crystals To NORMAL
                    ArrayList SGADevice = new ArrayList();
                    foreach (Item item in World.Items.Values)
                    {
                        if (item is SGActivatorDevice)
                            SGADevice.Add(item);
                    }

                    foreach (Item item in SGADevice)
                        (item).Hue = 0;
                }
            }
        }