コード例 #1
0
        public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;
            int destIndex = 0; // index of destination
            int fromIndex = 0; // index of origin

            if (!from.InRange(m_sgactivatordevice.GetWorldLocation(), 1) || from.Map != m_sgactivatordevice.Map)
            {
                from.SendMessage(33, "You are too far away to use that.");
                m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                from.CloseGump(typeof(SGGumpActivatorDevice));
            }
            else
            {
                // Allow use of the gate

                #region selection1
                if (sgTOselectioncounter == 1)
                {
                    switch (info.ButtonID)
                    {
                        case 0:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                sgTOfacetid = sgTOfacetid + 1;
                                if (sgTOfacetid >= 5)
                                {
                                    sgTOfacetid = 5;
                                }
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));

                            }
                            break;

                        case 1:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                sgTOfacetid = sgTOfacetid - 1;
                                if (sgTOfacetid <= 1)
                                {
                                    sgTOfacetid = 1;
                                }
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));

                            }
                            break;

                        case 2:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                int sgTOaddress1 = 1;
                                sgTOselectioncounter++;
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));

                            }
                            break;

                        case 3:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                int sgTOaddress1 = 2;
                                sgTOselectioncounter++;
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));

                            }
                            break;

                        case 4:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                int sgTOaddress1 = 3;
                                sgTOselectioncounter++;
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));

                            }
                            break;

                        case 5:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                int sgTOaddress1 = 4;
                                sgTOselectioncounter++;

                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 6:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                int sgTOaddress1 = 5;
                                sgTOselectioncounter++;
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));

                            }
                            break;

                        case 7:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButtonActivate);
                                from.CloseGump(typeof(SGGumpActivatorDevice));

                                // check I can go from here
                                bool stage1check = false;

                                for (int i = 0; i < SGCore.SGList.Count; i++)
                                {
                                    SGEntry sge = (SGEntry)SGCore.SGList[i];
                                    {
                                        if (sge.SGFacetCode == m_sgactivatordevice.SGAFacetNumber && sge.SGAddressCode1 == m_sgactivatordevice.SGAAddressCode1 && sge.SGAddressCode2 == m_sgactivatordevice.SGAAddressCode2 && sge.SGAddressCode3 == m_sgactivatordevice.SGAAddressCode3 && sge.SGAddressCode4 == m_sgactivatordevice.SGAAddressCode4 && sge.SGAddressCode5 == m_sgactivatordevice.SGAAddressCode5)
                                        {
                                            // this gate
                                            fromIndex = i;
                                            if (!sge.SGEnergy)
                                            {
                                                // i can continue
                                                stage1check = true;
                                            }
                                            else
                                            {
                                                from.SendMessage(33, "The altar doesn't seem to respond.");

                                                m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                                m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                                m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                                            }
                                        }
                                    }
                                }

                                if (stage1check)
                                {
                                    // find destination
                                    for (int i = 0; i < SGCore.SGList.Count; i++)
                                    {
                                        SGEntry sge = (SGEntry)SGCore.SGList[i];
                                        if (sge.SGFacetCode == sgTOfacetid && sge.SGAddressCode1 == sgTOaddress1 && sge.SGAddressCode2 == sgTOaddress2 && sge.SGAddressCode3 == sgTOaddress3 && sge.SGAddressCode4 == sgTOaddress4 && sge.SGAddressCode5 == sgTOaddress5)
                                        {
                                            // match
                                            if (sge.SGFacetCode == m_sgactivatordevice.SGAFacetNumber && sge.SGAddressCode1 == m_sgactivatordevice.SGAAddressCode1 && sge.SGAddressCode2 == m_sgactivatordevice.SGAAddressCode2 && sge.SGAddressCode3 == m_sgactivatordevice.SGAAddressCode3 && sge.SGAddressCode4 == m_sgactivatordevice.SGAAddressCode4 && sge.SGAddressCode5 == m_sgactivatordevice.SGAAddressCode5)
                                            {
                                                // Already here (Code selected was same code)
                                                from.SendMessage(33, "The altar does nothing, it would appear.");
                                                m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                                m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                                m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                                            }
                                            else
                                            {
                                                // match and different from where you are
                                                destIndex = i;

                                                sgDESTINATIONlocX = sge.SGX;
                                                sgDESTINATIONlocY = sge.SGY;
                                                sgDESTINATIONlocZ = sge.SGZ;
                                                sgDESTINATIONfacing = sge.SGFacing;

                                                sgDESTINATIONfacet = sge.SGFacetCode;
                                                sgDESTINATIONaddress1 = sge.SGAddressCode1;
                                                sgDESTINATIONaddress2 = sge.SGAddressCode2;
                                                sgDESTINATIONaddress3 = sge.SGAddressCode3;
                                                sgDESTINATIONaddress4 = sge.SGAddressCode4;
                                                sgDESTINATIONaddress5 = sge.SGAddressCode5;

                                                sgDESTINATIONbusyused = sge.SGBeingUsed;
                                                sgDESTINATIONbusyenergy = sge.SGEnergy;

                                                if (!sgDESTINATIONbusyenergy)
                                                {
                                                    Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundGoodToGo);

                                                    // setup energy bits
                                                    SGEntry sgeDestination = (SGEntry)SGCore.SGList[destIndex];
                                                    sgeDestination.SGEnergy = true; // turn ON energy bit at DESTINATION gate (stops outbound calls)
                                                    SGEntry sgeOrigin = (SGEntry)SGCore.SGList[fromIndex];
                                                    sgeOrigin.SGEnergy = true; // turn ON energy HERE (stops inbounds)
                                                    from.SendMessage("The altar erupts with activity!");

                                                    m_sgactivatordevice.m_SGABeingUsed = false; // release dialer HERE
                                                    m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                                    m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter

                                                    // place SGTeleport Tile into doorway TO THE DESTINATION Location (FROM HERE TO x,y,z)
                                                    if (sgDESTINATIONfacet == 1)
                                                    {
                                                        // Tile FROM Here TO Destination
                                                        SGFieldTile SGTileFROM = new SGFieldTile(fromIndex, destIndex, new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ + 6), Map.Felucca);
                                                        SGTileFROM.MoveToWorld(new Point3D(m_sgactivatordevice.X -1, m_sgactivatordevice.Y - 4, m_sgactivatordevice.Z + 6), m_sgactivatordevice.Map);
                                                        // Tile FROM Destination To Here
                                                        SGFieldTile SGTileBACK = new SGFieldTile(fromIndex, destIndex, new Point3D(m_sgactivatordevice.X, m_sgactivatordevice.Y - 4 , m_sgactivatordevice.Z + 6), m_sgactivatordevice.Map);
                                                        SGTileBACK.MoveToWorld(new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ + 6), Map.Felucca);

                                                        // ORIGIN ENERGY FIELD

                                                            SGCore.SGEffectEastWest(fromIndex);
                                                            // place energy field in doorway
                                                            SGEFieldEast SGEnergyTile1 = new SGEFieldEast(m_sgactivatordevice.Location, m_sgactivatordevice.Map);
                                                            SGEnergyTile1.MoveToWorld(new Point3D(m_sgactivatordevice.X -1, m_sgactivatordevice.Y - 4, m_sgactivatordevice.Z + 6), m_sgactivatordevice.Map);
                                                            SGParts SGEnergyTile2 = new SGParts(m_sgactivatordevice.Location, m_sgactivatordevice.Map);
                                                            SGEnergyTile2.MoveToWorld(new Point3D(m_sgactivatordevice.X -1, m_sgactivatordevice.Y - 4, m_sgactivatordevice.Z + 7), m_sgactivatordevice.Map);

                                                        // DESTINATION ENERGY FIELD

                                                            SGCore.SGEffectEastWest(destIndex);
                                                            // place energy field in doorway
                                                            SGEFieldEast SGEnergyTile1d = new SGEFieldEast(new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ), Map.Felucca);
                                                            SGEnergyTile1d.MoveToWorld(new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ + 6), Map.Felucca);
                                                            SGParts SGEnergyTile2d = new SGParts(new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ), Map.Felucca);
                                                            SGEnergyTile2d.MoveToWorld(new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ + 7), Map.Felucca);

                                                    }
                                                }
                                                else
                                                {
                                                    Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundNoTravel);
                                                    from.SendMessage(33, "The altar doesn't seem to respond.");
                                                    m_sgactivatordevice.m_SGABeingUsed = false; // release dialer HERE
                                                }
                                            }
                                        }
                                        m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                        m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                        m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                                    }
                                }
                                m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                            }
                            break;

                        case 8:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.SendMessage(33, "You turn the page, and begin anew.");
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                int sgTOaddress1 = reset;
                                int sgTOaddress2 = reset;
                                int sgTOaddress3 = reset;
                                int sgTOaddress4 = reset;
                                int sgTOaddress5 = reset;
                                sgTOselectioncounter = 1;
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 9:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.SendMessage(33, "You remove your spellbook from the altar.");
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                            }
                            break;

                        case 10:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.SendMessage(33, "Help Option selected");
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 11:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                                from.SendGump(new SGGumpActivatorRemoval(m_sgactivatordevice));
                            }
                            break;
                    }
                }
                #endregion selection1

                #region selection2
                else if (sgTOselectioncounter == 2)
                {
                    switch (info.ButtonID)
                    {
                        case 0:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                sgTOfacetid = sgTOfacetid + 1;
                                if (sgTOfacetid >= 5)
                                {
                                    sgTOfacetid = 5;
                                }
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 1:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                sgTOfacetid = sgTOfacetid - 1;
                                if (sgTOfacetid <= 1)
                                {
                                    sgTOfacetid = 1;
                                }
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 2:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                int sgTOaddress2 = 1;
                                sgTOselectioncounter++;
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 3:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                int sgTOaddress2 = 2;
                                sgTOselectioncounter++;
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 4:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                int sgTOaddress2 = 3;
                                sgTOselectioncounter++;
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 5:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                int sgTOaddress2 = 4;
                                sgTOselectioncounter++;
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 6:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                int sgTOaddress2 = 5;
                                sgTOselectioncounter++;
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 7:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButtonActivate);
                                from.CloseGump(typeof(SGGumpActivatorDevice));

                                // check I can go from here
                                bool stage1check = false;

                                for (int i = 0; i < SGCore.SGList.Count; i++)
                                {
                                    SGEntry sge = (SGEntry)SGCore.SGList[i];
                                    {
                                        if (sge.SGFacetCode == m_sgactivatordevice.SGAFacetNumber && sge.SGAddressCode1 == m_sgactivatordevice.SGAAddressCode1 && sge.SGAddressCode2 == m_sgactivatordevice.SGAAddressCode2 && sge.SGAddressCode3 == m_sgactivatordevice.SGAAddressCode3 && sge.SGAddressCode4 == m_sgactivatordevice.SGAAddressCode4 && sge.SGAddressCode5 == m_sgactivatordevice.SGAAddressCode5)
                                        {
                                            // this gate
                                            fromIndex = i;
                                            if (!sge.SGEnergy)
                                            {
                                                // i can continue
                                                stage1check = true;
                                            }
                                            else
                                            {
                                                from.SendMessage(33, "The altar appears to be in use...");
                                                m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                                m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                                m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                                            }
                                        }
                                    }
                                }

                                if (stage1check)
                                {
                                    // find destination
                                    for (int i = 0; i < SGCore.SGList.Count; i++)
                                    {
                                        SGEntry sge = (SGEntry)SGCore.SGList[i];
                                        if (sge.SGFacetCode == sgTOfacetid && sge.SGAddressCode1 == sgTOaddress1 && sge.SGAddressCode2 == sgTOaddress2 && sge.SGAddressCode3 == sgTOaddress3 && sge.SGAddressCode4 == sgTOaddress4 && sge.SGAddressCode5 == sgTOaddress5)
                                        {
                                            // match
                                            if (sge.SGFacetCode == m_sgactivatordevice.SGAFacetNumber && sge.SGAddressCode1 == m_sgactivatordevice.SGAAddressCode1 && sge.SGAddressCode2 == m_sgactivatordevice.SGAAddressCode2 && sge.SGAddressCode3 == m_sgactivatordevice.SGAAddressCode3 && sge.SGAddressCode4 == m_sgactivatordevice.SGAAddressCode4 && sge.SGAddressCode5 == m_sgactivatordevice.SGAAddressCode5)
                                            {
                                                // Already here (Code selected was same code)
                                                from.SendMessage(33, "Nothing seems to happen...");
                                                m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                                m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                                m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                                            }
                                            else
                                            {
                                                // match and different from where you are
                                                destIndex = i;

                                                sgDESTINATIONlocX = sge.SGX;
                                                sgDESTINATIONlocY = sge.SGY;
                                                sgDESTINATIONlocZ = sge.SGZ;
                                                sgDESTINATIONfacing = sge.SGFacing;

                                                sgDESTINATIONfacet = sge.SGFacetCode;
                                                sgDESTINATIONaddress1 = sge.SGAddressCode1;
                                                sgDESTINATIONaddress2 = sge.SGAddressCode2;
                                                sgDESTINATIONaddress3 = sge.SGAddressCode3;
                                                sgDESTINATIONaddress4 = sge.SGAddressCode4;
                                                sgDESTINATIONaddress5 = sge.SGAddressCode5;

                                                sgDESTINATIONbusyused = sge.SGBeingUsed;
                                                sgDESTINATIONbusyenergy = sge.SGEnergy;

                                                if (!sgDESTINATIONbusyenergy)
                                                {
                                                    Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundGoodToGo);

                                                    // setup energy bits
                                                    SGEntry sgeDestination = (SGEntry)SGCore.SGList[destIndex];
                                                    sgeDestination.SGEnergy = true; // turn ON energy bit at DESTINATION gate (stops outbound calls)
                                                    SGEntry sgeOrigin = (SGEntry)SGCore.SGList[fromIndex];
                                                    sgeOrigin.SGEnergy = true; // turn ON energy HERE (stops inbounds)

                                                    m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                                    m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                                    m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counters

                                                   // place SGTeleport Tile into doorway TO THE DESTINATION Location (FROM HERE TO x,y,z)
                                                    if (sgDESTINATIONfacet == 1)
                                                    {
                                                        // Tile FROM Here TO Destination
                                                        SGFieldTile SGTileFROM = new SGFieldTile(fromIndex, destIndex, new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ + 6), Map.Felucca);
                                                        SGTileFROM.MoveToWorld(new Point3D(m_sgactivatordevice.X -1, m_sgactivatordevice.Y - 4, m_sgactivatordevice.Z + 6), m_sgactivatordevice.Map);
                                                        // Tile FROM Destination To Here
                                                        SGFieldTile SGTileBACK = new SGFieldTile(fromIndex, destIndex, new Point3D(m_sgactivatordevice.X, m_sgactivatordevice.Y - 4 , m_sgactivatordevice.Z + 6), m_sgactivatordevice.Map);
                                                        SGTileBACK.MoveToWorld(new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ + 6), Map.Felucca);

                                                        // ORIGIN ENERGY FIELD

                                                            SGCore.SGEffectEastWest(fromIndex);
                                                            // place energy field in doorway
                                                            SGEFieldEast SGEnergyTile1 = new SGEFieldEast(m_sgactivatordevice.Location, m_sgactivatordevice.Map);
                                                            SGEnergyTile1.MoveToWorld(new Point3D(m_sgactivatordevice.X -1, m_sgactivatordevice.Y - 4, m_sgactivatordevice.Z + 6), m_sgactivatordevice.Map);
                                                            SGParts SGEnergyTile2 = new SGParts(m_sgactivatordevice.Location, m_sgactivatordevice.Map);
                                                            SGEnergyTile2.MoveToWorld(new Point3D(m_sgactivatordevice.X -1, m_sgactivatordevice.Y - 4, m_sgactivatordevice.Z + 7), m_sgactivatordevice.Map);

                                                        // DESTINATION ENERGY FIELD

                                                            SGCore.SGEffectEastWest(destIndex);
                                                            // place energy field in doorway
                                                            SGEFieldEast SGEnergyTile1d = new SGEFieldEast(new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ), Map.Felucca);
                                                            SGEnergyTile1d.MoveToWorld(new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ + 6), Map.Felucca);
                                                            SGParts SGEnergyTile2d = new SGParts(new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ), Map.Felucca);
                                                            SGEnergyTile2d.MoveToWorld(new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ + 7), Map.Felucca);

                                                    }

                                                    // check direction of DESTINATION GATE, place energy tiles
                                                }
                                                else
                                                {
                                                    Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundNoTravel);
                                                    from.SendMessage(33, "Nothing seems to happen...");
                                                    m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                                    m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                                    m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                                                }
                                            }
                                        }
                                        m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                        m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                        m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                                    }
                                }
                                m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                            }
                            break;

                        case 8:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.SendMessage(33, "You turn to a new page and start over.");
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                int sgTOaddress1 = reset;
                                int sgTOaddress2 = reset;
                                int sgTOaddress3 = reset;
                                int sgTOaddress4 = reset;
                                int sgTOaddress5 = reset;
                                sgTOselectioncounter = 1;
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 9:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                            }
                            break;

                        case 10:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.SendMessage(33, "help");
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 11:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                                from.SendGump(new SGGumpActivatorRemoval(m_sgactivatordevice));
                            }
                            break;
                    }
                }
                #endregion selection2

                #region selection3
                else if (sgTOselectioncounter == 3)
                {
                    switch (info.ButtonID)
                    {
                        case 0:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                sgTOfacetid = sgTOfacetid + 1;
                                if (sgTOfacetid >= 5)
                                {
                                    sgTOfacetid = 5;
                                }
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 1:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                sgTOfacetid = sgTOfacetid - 1;
                                if (sgTOfacetid <= 1)
                                {
                                    sgTOfacetid = 1;
                                }
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 2:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                int sgTOaddress3 = 1;
                                sgTOselectioncounter++;
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 3:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                int sgTOaddress3 = 2;
                                sgTOselectioncounter++;
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 4:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                int sgTOaddress3 = 3;
                                sgTOselectioncounter++;
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 5:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                int sgTOaddress3 = 4;
                                sgTOselectioncounter++;
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 6:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                int sgTOaddress3 = 5;
                                sgTOselectioncounter++;
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 7:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButtonActivate);
                                from.CloseGump(typeof(SGGumpActivatorDevice));

                                // check I can go from here
                                bool stage1check = false;

                                for (int i = 0; i < SGCore.SGList.Count; i++)
                                {
                                    SGEntry sge = (SGEntry)SGCore.SGList[i];
                                    {
                                        if (sge.SGFacetCode == m_sgactivatordevice.SGAFacetNumber && sge.SGAddressCode1 == m_sgactivatordevice.SGAAddressCode1 && sge.SGAddressCode2 == m_sgactivatordevice.SGAAddressCode2 && sge.SGAddressCode3 == m_sgactivatordevice.SGAAddressCode3 && sge.SGAddressCode4 == m_sgactivatordevice.SGAAddressCode4 && sge.SGAddressCode5 == m_sgactivatordevice.SGAAddressCode5)
                                        {
                                            // this gate
                                            fromIndex = i;
                                            if (!sge.SGEnergy)
                                            {
                                                // i can continue
                                                stage1check = true;
                                            }
                                            else
                                            {
                                                from.SendMessage(33, "The altar doesn't seem to respond.");
                                                m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                                m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                                m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                                            }
                                        }
                                    }
                                }

                                if (stage1check)
                                {
                                    // find destination
                                    for (int i = 0; i < SGCore.SGList.Count; i++)
                                    {
                                        SGEntry sge = (SGEntry)SGCore.SGList[i];
                                        if (sge.SGFacetCode == sgTOfacetid && sge.SGAddressCode1 == sgTOaddress1 && sge.SGAddressCode2 == sgTOaddress2 && sge.SGAddressCode3 == sgTOaddress3 && sge.SGAddressCode4 == sgTOaddress4 && sge.SGAddressCode5 == sgTOaddress5)
                                        {
                                            // match
                                            if (sge.SGFacetCode == m_sgactivatordevice.SGAFacetNumber && sge.SGAddressCode1 == m_sgactivatordevice.SGAAddressCode1 && sge.SGAddressCode2 == m_sgactivatordevice.SGAAddressCode2 && sge.SGAddressCode3 == m_sgactivatordevice.SGAAddressCode3 && sge.SGAddressCode4 == m_sgactivatordevice.SGAAddressCode4 && sge.SGAddressCode5 == m_sgactivatordevice.SGAAddressCode5)
                                            {
                                                // Already here (Code selected was same code)
                                                from.SendMessage(33, "Nothing seems to happen...");
                                                m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                                m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                                m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                                            }
                                            else
                                            {
                                                // match and different from where you are
                                                destIndex = i;

                                                sgDESTINATIONlocX = sge.SGX;
                                                sgDESTINATIONlocY = sge.SGY;
                                                sgDESTINATIONlocZ = sge.SGZ;
                                                sgDESTINATIONfacing = sge.SGFacing;

                                                sgDESTINATIONfacet = sge.SGFacetCode;
                                                sgDESTINATIONaddress1 = sge.SGAddressCode1;
                                                sgDESTINATIONaddress2 = sge.SGAddressCode2;
                                                sgDESTINATIONaddress3 = sge.SGAddressCode3;
                                                sgDESTINATIONaddress4 = sge.SGAddressCode4;
                                                sgDESTINATIONaddress5 = sge.SGAddressCode5;

                                                sgDESTINATIONbusyused = sge.SGBeingUsed;
                                                sgDESTINATIONbusyenergy = sge.SGEnergy;

                                                if (!sgDESTINATIONbusyenergy)
                                                {
                                                    Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundGoodToGo);

                                                    // setup energy bits
                                                    SGEntry sgeDestination = (SGEntry)SGCore.SGList[destIndex];
                                                    sgeDestination.SGEnergy = true; // turn ON energy bit at DESTINATION gate (stops outbound calls)
                                                    SGEntry sgeOrigin = (SGEntry)SGCore.SGList[fromIndex];
                                                    sgeOrigin.SGEnergy = true; // turn ON energy HERE (stops inbounds)

                                                    m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                                    m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                                    m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter

                                                    // place SGTeleport Tile into doorway TO THE DESTINATION Location (FROM HERE TO x,y,z)
                                                    if (sgDESTINATIONfacet == 1)
                                                    {
                                                        // Tile FROM Here TO Destination
                                                        SGFieldTile SGTileFROM = new SGFieldTile(fromIndex, destIndex, new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ + 6), Map.Felucca);
                                                        SGTileFROM.MoveToWorld(new Point3D(m_sgactivatordevice.X -1, m_sgactivatordevice.Y - 4, m_sgactivatordevice.Z + 6), m_sgactivatordevice.Map);
                                                        // Tile FROM Destination To Here
                                                        SGFieldTile SGTileBACK = new SGFieldTile(fromIndex, destIndex, new Point3D(m_sgactivatordevice.X, m_sgactivatordevice.Y - 4 , m_sgactivatordevice.Z + 6), m_sgactivatordevice.Map);
                                                        SGTileBACK.MoveToWorld(new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ + 6), Map.Felucca);

                                                        // ORIGIN ENERGY FIELD

                                                            SGCore.SGEffectEastWest(fromIndex);
                                                            // place energy field in doorway
                                                            SGEFieldEast SGEnergyTile1 = new SGEFieldEast(m_sgactivatordevice.Location, m_sgactivatordevice.Map);
                                                            SGEnergyTile1.MoveToWorld(new Point3D(m_sgactivatordevice.X -1, m_sgactivatordevice.Y - 4, m_sgactivatordevice.Z + 6), m_sgactivatordevice.Map);
                                                            SGParts SGEnergyTile2 = new SGParts(m_sgactivatordevice.Location, m_sgactivatordevice.Map);
                                                            SGEnergyTile2.MoveToWorld(new Point3D(m_sgactivatordevice.X -1, m_sgactivatordevice.Y - 4, m_sgactivatordevice.Z + 7), m_sgactivatordevice.Map);

                                                        // DESTINATION ENERGY FIELD

                                                            SGCore.SGEffectEastWest(destIndex);
                                                            // place energy field in doorway
                                                            SGEFieldEast SGEnergyTile1d = new SGEFieldEast(new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ), Map.Felucca);
                                                            SGEnergyTile1d.MoveToWorld(new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ + 6), Map.Felucca);
                                                            SGParts SGEnergyTile2d = new SGParts(new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ), Map.Felucca);
                                                            SGEnergyTile2d.MoveToWorld(new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ + 7), Map.Felucca);

                                                    }
                                                }
                                                else
                                                {
                                                    Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundNoTravel);
                                                    from.SendMessage(33, "The altar doesn't seem to respond.");
                                                    m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                                    m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                                    m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                                                }
                                            }
                                        }
                                        m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                        m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                        m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                                    }
                                }
                                m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                            }
                            break;

                        case 8:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.SendMessage(33, "You turn to a new page and start over.");
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                int sgTOaddress1 = reset;
                                int sgTOaddress2 = reset;
                                int sgTOaddress3 = reset;
                                int sgTOaddress4 = reset;
                                int sgTOaddress5 = reset;
                                sgTOselectioncounter = 1;
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 9:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                            }
                            break;

                        case 10:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.SendMessage(33, "help");
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 11:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                                from.SendGump(new SGGumpActivatorRemoval(m_sgactivatordevice));
                            }
                            break;
                    }
                }
                #endregion selection3

                #region selection4
                else if (sgTOselectioncounter == 4)
                {
                    switch (info.ButtonID)
                    {
                        case 0:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                sgTOfacetid = sgTOfacetid + 1;
                                if (sgTOfacetid >= 5)
                                {
                                    sgTOfacetid = 5;
                                }
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 1:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                sgTOfacetid = sgTOfacetid - 1;
                                if (sgTOfacetid <= 1)
                                {
                                    sgTOfacetid = 1;
                                }
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 2:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                int sgTOaddress4 = 1;
                                sgTOselectioncounter++;
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 3:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                int sgTOaddress4 = 2;
                                sgTOselectioncounter++;
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 4:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                int sgTOaddress4 = 3;
                                sgTOselectioncounter++;
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 5:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                int sgTOaddress4 = 4;
                                sgTOselectioncounter++;
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 6:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                int sgTOaddress4 = 5;
                                sgTOselectioncounter++;
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 7:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButtonActivate);
                                from.CloseGump(typeof(SGGumpActivatorDevice));

                                // check I can go from here
                                bool stage1check = false;

                                for (int i = 0; i < SGCore.SGList.Count; i++)
                                {
                                    SGEntry sge = (SGEntry)SGCore.SGList[i];
                                    {
                                        if (sge.SGFacetCode == m_sgactivatordevice.SGAFacetNumber && sge.SGAddressCode1 == m_sgactivatordevice.SGAAddressCode1 && sge.SGAddressCode2 == m_sgactivatordevice.SGAAddressCode2 && sge.SGAddressCode3 == m_sgactivatordevice.SGAAddressCode3 && sge.SGAddressCode4 == m_sgactivatordevice.SGAAddressCode4 && sge.SGAddressCode5 == m_sgactivatordevice.SGAAddressCode5)
                                        {
                                            // this gate
                                            fromIndex = i;
                                            if (!sge.SGEnergy)
                                            {
                                                // i can continue
                                                stage1check = true;
                                            }
                                            else
                                            {
                                                from.SendMessage(33, "The altar doesn't seem to respond.");
                                                m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                                m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                                m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                                            }
                                        }
                                    }
                                }

                                if (stage1check)
                                {
                                    // find destination
                                    for (int i = 0; i < SGCore.SGList.Count; i++)
                                    {
                                        SGEntry sge = (SGEntry)SGCore.SGList[i];
                                        if (sge.SGFacetCode == sgTOfacetid && sge.SGAddressCode1 == sgTOaddress1 && sge.SGAddressCode2 == sgTOaddress2 && sge.SGAddressCode3 == sgTOaddress3 && sge.SGAddressCode4 == sgTOaddress4 && sge.SGAddressCode5 == sgTOaddress5)
                                        {
                                            // match
                                            if (sge.SGFacetCode == m_sgactivatordevice.SGAFacetNumber && sge.SGAddressCode1 == m_sgactivatordevice.SGAAddressCode1 && sge.SGAddressCode2 == m_sgactivatordevice.SGAAddressCode2 && sge.SGAddressCode3 == m_sgactivatordevice.SGAAddressCode3 && sge.SGAddressCode4 == m_sgactivatordevice.SGAAddressCode4 && sge.SGAddressCode5 == m_sgactivatordevice.SGAAddressCode5)
                                            {
                                                // Already here (Code selected was same code)
                                                from.SendMessage(33, "Nothing seems to happen...");
                                                m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                                m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                                m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                                            }
                                            else
                                            {
                                                // match and different from where you are
                                                destIndex = i;

                                                sgDESTINATIONlocX = sge.SGX;
                                                sgDESTINATIONlocY = sge.SGY;
                                                sgDESTINATIONlocZ = sge.SGZ;
                                                sgDESTINATIONfacing = sge.SGFacing;

                                                sgDESTINATIONfacet = sge.SGFacetCode;
                                                sgDESTINATIONaddress1 = sge.SGAddressCode1;
                                                sgDESTINATIONaddress2 = sge.SGAddressCode2;
                                                sgDESTINATIONaddress3 = sge.SGAddressCode3;
                                                sgDESTINATIONaddress4 = sge.SGAddressCode4;
                                                sgDESTINATIONaddress5 = sge.SGAddressCode5;

                                                sgDESTINATIONbusyused = sge.SGBeingUsed;
                                                sgDESTINATIONbusyenergy = sge.SGEnergy;

                                                if (!sgDESTINATIONbusyenergy)
                                                {
                                                    Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundGoodToGo);

                                                    // setup energy bits
                                                    SGEntry sgeDestination = (SGEntry)SGCore.SGList[destIndex];
                                                    sgeDestination.SGEnergy = true; // turn ON energy bit at DESTINATION gate (stops outbound calls)
                                                    SGEntry sgeOrigin = (SGEntry)SGCore.SGList[fromIndex];
                                                    sgeOrigin.SGEnergy = true; // turn ON energy HERE (stops inbounds)

                                                    m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                                    m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                                    m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter

                                                   // place SGTeleport Tile into doorway TO THE DESTINATION Location (FROM HERE TO x,y,z)
                                                    if (sgDESTINATIONfacet == 1)
                                                    {
                                                        // Tile FROM Here TO Destination
                                                        SGFieldTile SGTileFROM = new SGFieldTile(fromIndex, destIndex, new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ + 6), Map.Felucca);
                                                        SGTileFROM.MoveToWorld(new Point3D(m_sgactivatordevice.X -1, m_sgactivatordevice.Y - 4, m_sgactivatordevice.Z + 6), m_sgactivatordevice.Map);
                                                        // Tile FROM Destination To Here
                                                        SGFieldTile SGTileBACK = new SGFieldTile(fromIndex, destIndex, new Point3D(m_sgactivatordevice.X, m_sgactivatordevice.Y - 4 , m_sgactivatordevice.Z + 6), m_sgactivatordevice.Map);
                                                        SGTileBACK.MoveToWorld(new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ + 6), Map.Felucca);

                                                        // ORIGIN ENERGY FIELD

                                                            SGCore.SGEffectEastWest(fromIndex);
                                                            // place energy field in doorway
                                                            SGEFieldEast SGEnergyTile1 = new SGEFieldEast(m_sgactivatordevice.Location, m_sgactivatordevice.Map);
                                                            SGEnergyTile1.MoveToWorld(new Point3D(m_sgactivatordevice.X -1, m_sgactivatordevice.Y - 4, m_sgactivatordevice.Z + 6), m_sgactivatordevice.Map);
                                                            SGParts SGEnergyTile2 = new SGParts(m_sgactivatordevice.Location, m_sgactivatordevice.Map);
                                                            SGEnergyTile2.MoveToWorld(new Point3D(m_sgactivatordevice.X -1, m_sgactivatordevice.Y - 4, m_sgactivatordevice.Z + 7), m_sgactivatordevice.Map);

                                                        // DESTINATION ENERGY FIELD

                                                            SGCore.SGEffectEastWest(destIndex);
                                                            // place energy field in doorway
                                                            SGEFieldEast SGEnergyTile1d = new SGEFieldEast(new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ), Map.Felucca);
                                                            SGEnergyTile1d.MoveToWorld(new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ + 6), Map.Felucca);
                                                            SGParts SGEnergyTile2d = new SGParts(new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ), Map.Felucca);
                                                            SGEnergyTile2d.MoveToWorld(new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ + 7), Map.Felucca);

                                                    }
                                                }
                                                else
                                                {
                                                    Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundNoTravel);
                                                    from.SendMessage(33, "The altar doesn't seem to respond.");
                                                    m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                                    m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                                    m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                                                }
                                            }
                                        }
                                        m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                        m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                        m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                                    }
                                }
                                m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                            }
                            break;

                        case 8:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.SendMessage(33, "You turn to a new page and start over.");
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                int sgTOaddress1 = reset;
                                int sgTOaddress2 = reset;
                                int sgTOaddress3 = reset;
                                int sgTOaddress4 = reset;
                                int sgTOaddress5 = reset;
                                sgTOselectioncounter = 1;
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 9:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                            }
                            break;

                        case 10:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.SendMessage(33, "help");
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 11:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                                from.SendGump(new SGGumpActivatorRemoval(m_sgactivatordevice));
                            }
                            break;
                    }
                }
                #endregion selection4

                #region selection5
                else if (sgTOselectioncounter == 5)
                {
                    switch (info.ButtonID)
                    {
                        case 0:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                sgTOfacetid = sgTOfacetid + 1;
                                if (sgTOfacetid >= 5)
                                {
                                    sgTOfacetid = 5;
                                }
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 1:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                sgTOfacetid = sgTOfacetid - 1;
                                if (sgTOfacetid <= 1)
                                {
                                    sgTOfacetid = 1;
                                }
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 2:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                int sgTOaddress5 = 1;
                                sgTOselectioncounter++;
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 3:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                int sgTOaddress5 = 2;
                                sgTOselectioncounter++;
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 4:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                int sgTOaddress5 = 3;
                                sgTOselectioncounter++;
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 5:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                int sgTOaddress5 = 4;
                                sgTOselectioncounter++;
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 6:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                int sgTOaddress5 = 5;
                                sgTOselectioncounter++;
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 7:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButtonActivate);
                                from.CloseGump(typeof(SGGumpActivatorDevice));

                                // check I can go from here
                                bool stage1check = false;

                                for (int i = 0; i < SGCore.SGList.Count; i++)
                                {
                                    SGEntry sge = (SGEntry)SGCore.SGList[i];
                                    {
                                        if (sge.SGFacetCode == m_sgactivatordevice.SGAFacetNumber && sge.SGAddressCode1 == m_sgactivatordevice.SGAAddressCode1 && sge.SGAddressCode2 == m_sgactivatordevice.SGAAddressCode2 && sge.SGAddressCode3 == m_sgactivatordevice.SGAAddressCode3 && sge.SGAddressCode4 == m_sgactivatordevice.SGAAddressCode4 && sge.SGAddressCode5 == m_sgactivatordevice.SGAAddressCode5)
                                        {
                                            // this gate
                                            fromIndex = i;
                                            if (!sge.SGEnergy)
                                            {
                                                // i can continue
                                                stage1check = true;
                                            }
                                            else
                                            {
                                                from.SendMessage(33, "The altar doesn't seem to respond.");
                                                m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                                m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                                m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                                            }
                                        }
                                    }
                                }

                                if (stage1check)
                                {
                                    // find destination
                                    for (int i = 0; i < SGCore.SGList.Count; i++)
                                    {
                                        SGEntry sge = (SGEntry)SGCore.SGList[i];
                                        if (sge.SGFacetCode == sgTOfacetid && sge.SGAddressCode1 == sgTOaddress1 && sge.SGAddressCode2 == sgTOaddress2 && sge.SGAddressCode3 == sgTOaddress3 && sge.SGAddressCode4 == sgTOaddress4 && sge.SGAddressCode5 == sgTOaddress5)
                                        {
                                            // match
                                            if (sge.SGFacetCode == m_sgactivatordevice.SGAFacetNumber && sge.SGAddressCode1 == m_sgactivatordevice.SGAAddressCode1 && sge.SGAddressCode2 == m_sgactivatordevice.SGAAddressCode2 && sge.SGAddressCode3 == m_sgactivatordevice.SGAAddressCode3 && sge.SGAddressCode4 == m_sgactivatordevice.SGAAddressCode4 && sge.SGAddressCode5 == m_sgactivatordevice.SGAAddressCode5)
                                            {
                                                // Already here (Code selected was same code)
                                                from.SendMessage(33, "Nothing seems to happen...");
                                                m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                                m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                                m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                                            }
                                            else
                                            {
                                                // match and different from where you are
                                                destIndex = i;

                                                sgDESTINATIONlocX = sge.SGX;
                                                sgDESTINATIONlocY = sge.SGY;
                                                sgDESTINATIONlocZ = sge.SGZ;
                                                sgDESTINATIONfacing = sge.SGFacing;

                                                sgDESTINATIONfacet = sge.SGFacetCode;
                                                sgDESTINATIONaddress1 = sge.SGAddressCode1;
                                                sgDESTINATIONaddress2 = sge.SGAddressCode2;
                                                sgDESTINATIONaddress3 = sge.SGAddressCode3;
                                                sgDESTINATIONaddress4 = sge.SGAddressCode4;
                                                sgDESTINATIONaddress5 = sge.SGAddressCode5;

                                                sgDESTINATIONbusyused = sge.SGBeingUsed;
                                                sgDESTINATIONbusyenergy = sge.SGEnergy;

                                                if (!sgDESTINATIONbusyenergy)
                                                {
                                                    Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundGoodToGo);

                                                    // setup energy bits
                                                    SGEntry sgeDestination = (SGEntry)SGCore.SGList[destIndex];
                                                    sgeDestination.SGEnergy = true; // turn ON energy bit at DESTINATION gate (stops outbound calls)
                                                    SGEntry sgeOrigin = (SGEntry)SGCore.SGList[fromIndex];
                                                    sgeOrigin.SGEnergy = true; // turn ON energy HERE (stops inbounds)

                                                    m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                                    m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                                    m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter

                                                    // place SGTeleport Tile into doorway TO THE DESTINATION Location (FROM HERE TO x,y,z)
                                                    if (sgDESTINATIONfacet == 1)
                                                    {
                                                        // Tile FROM Here TO Destination
                                                        SGFieldTile SGTileFROM = new SGFieldTile(fromIndex, destIndex, new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ + 6), Map.Felucca);
                                                        SGTileFROM.MoveToWorld(new Point3D(m_sgactivatordevice.X -1, m_sgactivatordevice.Y - 4, m_sgactivatordevice.Z + 6), m_sgactivatordevice.Map);
                                                        // Tile FROM Destination To Here
                                                        SGFieldTile SGTileBACK = new SGFieldTile(fromIndex, destIndex, new Point3D(m_sgactivatordevice.X, m_sgactivatordevice.Y - 4 , m_sgactivatordevice.Z + 6), m_sgactivatordevice.Map);
                                                        SGTileBACK.MoveToWorld(new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ + 6), Map.Felucca);

                                                        // ORIGIN ENERGY FIELD

                                                            SGCore.SGEffectEastWest(fromIndex);
                                                            // place energy field in doorway
                                                            SGEFieldEast SGEnergyTile1 = new SGEFieldEast(m_sgactivatordevice.Location, m_sgactivatordevice.Map);
                                                            SGEnergyTile1.MoveToWorld(new Point3D(m_sgactivatordevice.X -1, m_sgactivatordevice.Y - 4, m_sgactivatordevice.Z + 6), m_sgactivatordevice.Map);
                                                            SGParts SGEnergyTile2 = new SGParts(m_sgactivatordevice.Location, m_sgactivatordevice.Map);
                                                            SGEnergyTile2.MoveToWorld(new Point3D(m_sgactivatordevice.X -1, m_sgactivatordevice.Y - 4, m_sgactivatordevice.Z + 7), m_sgactivatordevice.Map);

                                                        // DESTINATION ENERGY FIELD

                                                            SGCore.SGEffectEastWest(destIndex);
                                                            // place energy field in doorway
                                                            SGEFieldEast SGEnergyTile1d = new SGEFieldEast(new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ), Map.Felucca);
                                                            SGEnergyTile1d.MoveToWorld(new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ + 6), Map.Felucca);
                                                            SGParts SGEnergyTile2d = new SGParts(new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ), Map.Felucca);
                                                            SGEnergyTile2d.MoveToWorld(new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ + 7), Map.Felucca);

                                                    }
                                                }
                                                else
                                                {
                                                    Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundNoTravel);
                                                    from.SendMessage(33, "The altar doesn't seem to respond.");
                                                    m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                                    m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                                    m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                                                }
                                            }
                                        }
                                        m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                        m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                        m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                                    }
                                }
                                m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                            }
                            break;

                        case 8:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.SendMessage(33, "You turn to a new page and start over.");
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                int sgTOaddress1 = reset;
                                int sgTOaddress2 = reset;
                                int sgTOaddress3 = reset;
                                int sgTOaddress4 = reset;
                                int sgTOaddress5 = reset;
                                sgTOselectioncounter = 1;
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 9:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                            }
                            break;

                        case 10:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.SendMessage(33, "help");
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 11:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                                from.SendGump(new SGGumpActivatorRemoval(m_sgactivatordevice));
                            }
                            break;
                    }
                }
                #endregion selection5

                #region selection6
                else if (sgTOselectioncounter == 6)
                {
                    switch (info.ButtonID)
                    {
                        case 0:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                sgTOfacetid = sgTOfacetid + 1;
                                if (sgTOfacetid >= 5)
                                {
                                    sgTOfacetid = 5;
                                }
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 1:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                sgTOfacetid = sgTOfacetid - 1;
                                if (sgTOfacetid <= 1)
                                {
                                    sgTOfacetid = 1;
                                }
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 2:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                //from.PublicOverheadMessage(MessageType.Whisper, 0, false, "Activate / Reset or Cancel");
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 3:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                //from.PublicOverheadMessage(MessageType.Whisper, 0, false, "Activate / Reset or Cancel");
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 4:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                //from.PublicOverheadMessage(MessageType.Whisper, 0, false, "Activate / Reset or Cancel");
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 5:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                //from.PublicOverheadMessage(MessageType.Whisper, 0, false, "Activate / Reset or Cancel");
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 6:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                               //from.PublicOverheadMessage(MessageType.Whisper, 0, false, "Activate / Reset or Cancel");
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 7:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButtonActivate);
                                from.CloseGump(typeof(SGGumpActivatorDevice));

                                // check I can go from here
                                bool stage1check = false;

                                for (int i = 0; i < SGCore.SGList.Count; i++)
                                {
                                    SGEntry sge = (SGEntry)SGCore.SGList[i];
                                    {
                                        if (sge.SGFacetCode == m_sgactivatordevice.SGAFacetNumber && sge.SGAddressCode1 == m_sgactivatordevice.SGAAddressCode1 && sge.SGAddressCode2 == m_sgactivatordevice.SGAAddressCode2 && sge.SGAddressCode3 == m_sgactivatordevice.SGAAddressCode3 && sge.SGAddressCode4 == m_sgactivatordevice.SGAAddressCode4 && sge.SGAddressCode5 == m_sgactivatordevice.SGAAddressCode5)
                                        {
                                            // this gate
                                            fromIndex = i;
                                            if (!sge.SGEnergy)
                                            {
                                                // i can continue
                                                stage1check = true;
                                            }
                                            else
                                            {
                                                from.SendMessage(33, "The altar doesn't seem to respond.");
                                                m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                                m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                                m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                                            }
                                        }
                                    }
                                }

                                if (stage1check)
                                {
                                    // find destination
                                    for (int i = 0; i < SGCore.SGList.Count; i++)
                                    {
                                        SGEntry sge = (SGEntry)SGCore.SGList[i];
                                        if (sge.SGFacetCode == sgTOfacetid && sge.SGAddressCode1 == sgTOaddress1 && sge.SGAddressCode2 == sgTOaddress2 && sge.SGAddressCode3 == sgTOaddress3 && sge.SGAddressCode4 == sgTOaddress4 && sge.SGAddressCode5 == sgTOaddress5)
                                        {
                                            // match
                                            if (sge.SGFacetCode == m_sgactivatordevice.SGAFacetNumber && sge.SGAddressCode1 == m_sgactivatordevice.SGAAddressCode1 && sge.SGAddressCode2 == m_sgactivatordevice.SGAAddressCode2 && sge.SGAddressCode3 == m_sgactivatordevice.SGAAddressCode3 && sge.SGAddressCode4 == m_sgactivatordevice.SGAAddressCode4 && sge.SGAddressCode5 == m_sgactivatordevice.SGAAddressCode5)
                                            {
                                                // Already here (Code selected was same code)
                                                from.SendMessage(33, "Nothing seems to happen...");
                                                m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                                m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                                m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                                            }
                                            else
                                            {
                                                // match and different from where you are
                                                destIndex = i;

                                                sgDESTINATIONlocX = sge.SGX;
                                                sgDESTINATIONlocY = sge.SGY;
                                                sgDESTINATIONlocZ = sge.SGZ;
                                                sgDESTINATIONfacing = sge.SGFacing;

                                                sgDESTINATIONfacet = sge.SGFacetCode;
                                                sgDESTINATIONaddress1 = sge.SGAddressCode1;
                                                sgDESTINATIONaddress2 = sge.SGAddressCode2;
                                                sgDESTINATIONaddress3 = sge.SGAddressCode3;
                                                sgDESTINATIONaddress4 = sge.SGAddressCode4;
                                                sgDESTINATIONaddress5 = sge.SGAddressCode5;

                                                sgDESTINATIONbusyused = sge.SGBeingUsed;
                                                sgDESTINATIONbusyenergy = sge.SGEnergy;

                                                if (!sgDESTINATIONbusyenergy)
                                                {
                                                    Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundGoodToGo);
                                                    // No energy field at DESTINATION gate, set bits
                                                    SGEntry sgeDestination = (SGEntry)SGCore.SGList[destIndex];
                                                    sgeDestination.SGEnergy = true; // turn ON energy bit at DESTINATION gate (stops outbound calls)
                                                    SGEntry sgeOrigin = (SGEntry)SGCore.SGList[fromIndex];
                                                    sgeOrigin.SGEnergy = true; // turn ON energy HERE (stops inbounds)

                                                    m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                                    m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                                    m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter

                                                   // place SGTeleport Tile into doorway TO THE DESTINATION Location (FROM HERE TO x,y,z)
                                                    if (sgDESTINATIONfacet == 1)
                                                    {
                                                        // Tile FROM Here TO Destination
                                                        SGFieldTile SGTileFROM = new SGFieldTile(fromIndex, destIndex, new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ + 6), Map.Felucca);
                                                        SGTileFROM.MoveToWorld(new Point3D(m_sgactivatordevice.X -1, m_sgactivatordevice.Y - 4, m_sgactivatordevice.Z + 6), m_sgactivatordevice.Map);
                                                        // Tile FROM Destination To Here
                                                        SGFieldTile SGTileBACK = new SGFieldTile(fromIndex, destIndex, new Point3D(m_sgactivatordevice.X, m_sgactivatordevice.Y - 4 , m_sgactivatordevice.Z + 6), m_sgactivatordevice.Map);
                                                        SGTileBACK.MoveToWorld(new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ + 6), Map.Felucca);

                                                        // ORIGIN ENERGY FIELD

                                                            SGCore.SGEffectEastWest(fromIndex);
                                                            // place energy field in doorway
                                                            SGEFieldEast SGEnergyTile1 = new SGEFieldEast(m_sgactivatordevice.Location, m_sgactivatordevice.Map);
                                                            SGEnergyTile1.MoveToWorld(new Point3D(m_sgactivatordevice.X -1, m_sgactivatordevice.Y - 4, m_sgactivatordevice.Z + 6), m_sgactivatordevice.Map);
                                                            SGParts SGEnergyTile2 = new SGParts(m_sgactivatordevice.Location, m_sgactivatordevice.Map);
                                                            SGEnergyTile2.MoveToWorld(new Point3D(m_sgactivatordevice.X -1, m_sgactivatordevice.Y - 4, m_sgactivatordevice.Z + 7), m_sgactivatordevice.Map);

                                                        // DESTINATION ENERGY FIELD

                                                            SGCore.SGEffectEastWest(destIndex);
                                                            // place energy field in doorway
                                                            SGEFieldEast SGEnergyTile1d = new SGEFieldEast(new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ), Map.Felucca);
                                                            SGEnergyTile1d.MoveToWorld(new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ + 6), Map.Felucca);
                                                            SGParts SGEnergyTile2d = new SGParts(new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ), Map.Felucca);
                                                            SGEnergyTile2d.MoveToWorld(new Point3D(sgDESTINATIONlocX, sgDESTINATIONlocY, sgDESTINATIONlocZ + 7), Map.Felucca);

                                                    }
                                                }
                                                else
                                                {
                                                    Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundNoTravel);
                                                    from.SendMessage(33, "The altar doesn't seem to respond.");
                                                    m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                                    m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                                    m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                                                }
                                            }
                                        }
                                        m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                        m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                        m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                                    }
                                }
                                m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                            }
                            break;

                        case 8:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.SendMessage(33, "You turn to a new page and start over.");
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                int sgTOaddress1 = reset;
                                int sgTOaddress2 = reset;
                                int sgTOaddress3 = reset;
                                int sgTOaddress4 = reset;
                                int sgTOaddress5 = reset;
                                sgTOselectioncounter = 1;
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 9:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                            }
                            break;

                        case 10:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.SendMessage(33, "help");
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                from.SendGump(new SGGumpActivatorDevice(from, m_sgactivatordevice, sgTOselectioncounter, sgTOfacetid, sgTOaddress1, sgTOaddress2, sgTOaddress3, sgTOaddress4, sgTOaddress5));
                            }
                            break;

                        case 11:
                            {
                                Effects.PlaySound(m_sgactivatordevice.Location, m_sgactivatordevice.Map, SGCore.SGSystemSoundButton);
                                from.CloseGump(typeof(SGGumpActivatorDevice));
                                m_sgactivatordevice.m_SGABeingUsed = false; // release dialer
                                m_sgactivatordevice.m_WhoClickedIt = "Blank"; // Reset Who clicked it value
                                m_sgactivatordevice.m_TimerCounter = 0; // Reset Timer Counter
                                from.SendGump(new SGGumpActivatorRemoval(m_sgactivatordevice));
                            }
                            break;
                    }
                }
            }
            #endregion selection6
        }
コード例 #2
0
            public InternalTimer(SGFieldTile m, Item item)
                : base(TimeSpan.FromSeconds(SGCore.SGSystemGateTime))
            {
                m_sgfieldtile = m;
                m_Item = item;

                Priority = TimerPriority.OneSecond;
            }