public override void OnResponse(Server.Network.NetState sender, RelayInfo info) { Mobile from = sender.Mobile; switch (info.ButtonID) { case 0: // Remove { if (!SGCore.SGSystemEnabled) { from.SendMessage(77, "Crystal & Address removed from the stargate system..."); from.CloseGump(typeof(SGGumpActivatorRemoval)); int removeIndex = 0; 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 removeIndex = i; } } } // Remove Address Entry SGEntry sgeToBeRemoved = (SGEntry)SGCore.SGList[removeIndex]; SGCore.SGList.Remove(sgeToBeRemoved); // *************************************************** // * Force a Rebuild of Entire Shard Stargate System * // *************************************************** // Trigger Save to Update Stargate XML File (With Your Removed Gate OUT) SGCore.SGTriggerSave(); // Trigger Load to Put Shards Stargates Back (With Your Removed Gate OUT) SGCore.SGTriggerLoad(); } else { from.SendMessage(77, "OPERATION ABORTED !!! Stargate System Still ACTIVE, Gates can only be removed IF the stargate system is DISABLED."); from.SendMessage(77, "Use [SGAdmin option to DISABLE the system 1st"); } } break; case 1: // Exit { from.SendMessage(77, "Exit Crystal Device Admin, This Device Remains In The System."); } break; } }
public override void OnResponse(Server.Network.NetState sender, RelayInfo info) { Mobile from = sender.Mobile; bool CanBeUsed = SGCore.SGSystemEnabled; bool BeingUsed = false; bool Energy = false; bool HideAdd = SGCore.SGSystemHideGate; string DiscoverName = "NooneYet"; // Just a temp filler (Avoid a null string) // Get value contained in the text input box string sgplatname = GetString(info, 21); switch (info.ButtonID) { case 1: { from.CloseGump(typeof(SGGumpAdministrator)); sgaddonid = sgaddonid - 1; if (sgaddonid <= 1) { sgaddonid = 1; } from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5)); } break; case 2: { from.CloseGump(typeof(SGGumpAdministrator)); sgaddonid = sgaddonid + 1; if (sgaddonid >= SGCore.SGAddonStyles) { sgaddonid = SGCore.SGAddonStyles; } from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5)); } break; case 3: { from.CloseGump(typeof(SGGumpAdministrator)); if (sgdir == "East") { sgdir = "S"; } from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5)); } break; case 4: { from.CloseGump(typeof(SGGumpAdministrator)); if (sgdir == "South") { sgdir = "E"; } from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5)); } break; case 5: { from.CloseGump(typeof(SGGumpAdministrator)); addcode1 = addcode1 - 1; if (addcode1 <= 1) { addcode1 = 1; } from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5)); } break; case 6: { from.CloseGump(typeof(SGGumpAdministrator)); addcode1 = addcode1 + 1; if (addcode1 >= 5) { addcode1 = 5; } from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5)); } break; case 7: { from.CloseGump(typeof(SGGumpAdministrator)); addcode2 = addcode2 - 1; if (addcode2 <= 1) { addcode2 = 1; } from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5)); } break; case 8: { from.CloseGump(typeof(SGGumpAdministrator)); addcode2 = addcode2 + 1; if (addcode2 >= 5) { addcode2 = 5; } from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5)); } break; case 9: { from.CloseGump(typeof(SGGumpAdministrator)); addcode3 = addcode3 - 1; if (addcode3 <= 1) { addcode3 = 1; } from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5)); } break; case 10: { from.CloseGump(typeof(SGGumpAdministrator)); addcode3 = addcode3 + 1; if (addcode3 >= 5) { addcode3 = 5; } from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5)); } break; case 11: { from.CloseGump(typeof(SGGumpAdministrator)); addcode4 = addcode4 - 1; if (addcode4 <= 1) { addcode4 = 1; } from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5)); } break; case 12: { from.CloseGump(typeof(SGGumpAdministrator)); addcode4 = addcode4 + 1; if (addcode4 >= 5) { addcode4 = 5; } from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5)); } break; case 13: { from.CloseGump(typeof(SGGumpAdministrator)); addcode5 = addcode5 - 1; if (addcode5 <= 1) { addcode5 = 1; } from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5)); } break; case 14: { from.CloseGump(typeof(SGGumpAdministrator)); addcode5 = addcode5 + 1; if (addcode5 >= 5) { addcode5 = 5; } from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5)); } break; case 15: { from.CloseGump(typeof(SGGumpAdministrator)); bool dupedgate = false; // Check which map the person adding a gate is actually on string whichmap = Convert.ToString(from.Map); if (whichmap == "Felucca") { facetid = 1; } if (whichmap == "Trammel") { facetid = 2; } if (whichmap == "Ilshenar") { facetid = 3; } if (whichmap == "Malas") { facetid = 4; } if (whichmap == "Tokuno") { facetid = 5; } // Check for duplicated addresses in the array for (int i = 0; i < SGCore.SGList.Count; i++) { SGEntry sge = (SGEntry)SGCore.SGList[i]; { if (sge.SGFacetCode == facetid && sge.SGAddressCode1 == addcode1 && sge.SGAddressCode2 == addcode2 && sge.SGAddressCode3 == addcode3 && sge.SGAddressCode4 == addcode4 && sge.SGAddressCode5 == addcode5) { dupedgate = true; } } } if (!dupedgate) { if (sgdir == "South" && sgaddonid == 1) { sgdir = "S"; Item SGASouth = new SGLocationAddon1South(); SGASouth.MoveToWorld(new Point3D(from.X, from.Y, from.Z), from.Map); } if (sgdir == "East" && sgaddonid == 1) { sgdir = "E"; Item SGAEast = new SGLocationAddon1East(); SGAEast.MoveToWorld(new Point3D(from.X, from.Y, from.Z), from.Map); } if (sgdir == "South" && sgaddonid == 2) { sgdir = "S"; Item SGASouth = new SGLocationAddon2South(); SGASouth.MoveToWorld(new Point3D(from.X, from.Y, from.Z), from.Map); } if (sgdir == "East" && sgaddonid == 2) { sgdir = "E"; Item SGAEast = new SGLocationAddon2East(); SGAEast.MoveToWorld(new Point3D(from.X, from.Y, from.Z), from.Map); } if (sgdir == "South" && sgaddonid == 3) { sgdir = "S"; Item SGASouth = new SGLocationAddon3South(); SGASouth.MoveToWorld(new Point3D(from.X, from.Y, from.Z), from.Map); } if (sgdir == "East" && sgaddonid == 3) { sgdir = "E"; Item SGAEast = new SGLocationAddon3East(); SGAEast.MoveToWorld(new Point3D(from.X, from.Y, from.Z), from.Map); } Item SGACrystal = new SGActivatorDevice(from.X, from.Y, from.Z, sgdir, sgaddonid, CanBeUsed, BeingUsed, Energy, HideAdd, DiscoverName, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5); SGACrystal.MoveToWorld(new Point3D(from.X + 2, from.Y - 2, from.Z), from.Map); // Add facet symbol to world for this stargate control crystal if (facetid == 1) { Item sgFIDsym = new SGFacetSymbol1(); sgFIDsym.MoveToWorld(new Point3D(from.Location.X + 1, from.Location.Y - 2, from.Location.Z), from.Map); } if (facetid == 2) { Item sgFIDsym = new SGFacetSymbol2(); sgFIDsym.MoveToWorld(new Point3D(from.Location.X + 1, from.Location.Y - 2, from.Location.Z), from.Map); } if (facetid == 3) { Item sgFIDsym = new SGFacetSymbol3(); sgFIDsym.MoveToWorld(new Point3D(from.Location.X + 1, from.Location.Y - 2, from.Location.Z), from.Map); } if (facetid == 4) { Item sgFIDsym = new SGFacetSymbol4(); sgFIDsym.MoveToWorld(new Point3D(from.Location.X + 1, from.Location.Y - 2, from.Location.Z), from.Map); } if (facetid == 5) { Item sgFIDsym = new SGFacetSymbol5(); sgFIDsym.MoveToWorld(new Point3D(from.Location.X + 1, from.Location.Y - 2, from.Location.Z), from.Map); } // Add 1st CODE symbol to the world if (addcode1 == 1) { Item sgAC1sym = new SGAddressSymbol1(); sgAC1sym.MoveToWorld(new Point3D(from.Location.X - 2, from.Location.Y + 2, from.Location.Z), from.Map); } if (addcode1 == 2) { Item sgAC1sym = new SGAddressSymbol2(); sgAC1sym.MoveToWorld(new Point3D(from.Location.X - 2, from.Location.Y + 2, from.Location.Z), from.Map); } if (addcode1 == 3) { Item sgAC1sym = new SGAddressSymbol3(); sgAC1sym.MoveToWorld(new Point3D(from.Location.X - 2, from.Location.Y + 2, from.Location.Z), from.Map); } if (addcode1 == 4) { Item sgAC1sym = new SGAddressSymbol4(); sgAC1sym.MoveToWorld(new Point3D(from.Location.X - 2, from.Location.Y + 2, from.Location.Z), from.Map); } if (addcode1 == 5) { Item sgAC1sym = new SGAddressSymbol5(); sgAC1sym.MoveToWorld(new Point3D(from.Location.X - 2, from.Location.Y + 2, from.Location.Z), from.Map); } // Add 2nd CODE symbol to the world if (addcode2 == 1) { Item sgAC2sym = new SGAddressSymbol1(); sgAC2sym.MoveToWorld(new Point3D(from.Location.X - 1, from.Location.Y + 2, from.Location.Z), from.Map); } if (addcode2 == 2) { Item sgAC2sym = new SGAddressSymbol2(); sgAC2sym.MoveToWorld(new Point3D(from.Location.X - 1, from.Location.Y + 2, from.Location.Z), from.Map); } if (addcode2 == 3) { Item sgAC2sym = new SGAddressSymbol3(); sgAC2sym.MoveToWorld(new Point3D(from.Location.X - 1, from.Location.Y + 2, from.Location.Z), from.Map); } if (addcode2 == 4) { Item sgAC2sym = new SGAddressSymbol4(); sgAC2sym.MoveToWorld(new Point3D(from.Location.X - 1, from.Location.Y + 2, from.Location.Z), from.Map); } if (addcode2 == 5) { Item sgAC2sym = new SGAddressSymbol5(); sgAC2sym.MoveToWorld(new Point3D(from.Location.X - 1, from.Location.Y + 2, from.Location.Z), from.Map); } // Add 3rd CODE symbol to the world if (addcode3 == 1) { Item sgAC3sym = new SGAddressSymbol1(); sgAC3sym.MoveToWorld(new Point3D(from.Location.X, from.Location.Y + 2, from.Location.Z), from.Map); } if (addcode3 == 2) { Item sgAC3sym = new SGAddressSymbol2(); sgAC3sym.MoveToWorld(new Point3D(from.Location.X, from.Location.Y + 2, from.Location.Z), from.Map); } if (addcode3 == 3) { Item sgAC3sym = new SGAddressSymbol3(); sgAC3sym.MoveToWorld(new Point3D(from.Location.X, from.Location.Y + 2, from.Location.Z), from.Map); } if (addcode3 == 4) { Item sgAC3sym = new SGAddressSymbol4(); sgAC3sym.MoveToWorld(new Point3D(from.Location.X, from.Location.Y + 2, from.Location.Z), from.Map); } if (addcode3 == 5) { Item sgAC3sym = new SGAddressSymbol5(); sgAC3sym.MoveToWorld(new Point3D(from.Location.X, from.Location.Y + 2, from.Location.Z), from.Map); } // Add 4th CODE symbol to the world if (addcode4 == 1) { Item sgAC4sym = new SGAddressSymbol1(); sgAC4sym.MoveToWorld(new Point3D(from.Location.X + 1, from.Location.Y + 2, from.Location.Z), from.Map); } if (addcode4 == 2) { Item sgAC4sym = new SGAddressSymbol2(); sgAC4sym.MoveToWorld(new Point3D(from.Location.X + 1, from.Location.Y + 2, from.Location.Z), from.Map); } if (addcode4 == 3) { Item sgAC4sym = new SGAddressSymbol3(); sgAC4sym.MoveToWorld(new Point3D(from.Location.X + 1, from.Location.Y + 2, from.Location.Z), from.Map); } if (addcode4 == 4) { Item sgAC4sym = new SGAddressSymbol4(); sgAC4sym.MoveToWorld(new Point3D(from.Location.X + 1, from.Location.Y + 2, from.Location.Z), from.Map); } if (addcode4 == 5) { Item sgAC4sym = new SGAddressSymbol5(); sgAC4sym.MoveToWorld(new Point3D(from.Location.X + 1, from.Location.Y + 2, from.Location.Z), from.Map); } // Add 5th CODE symbol to the world if (addcode5 == 1) { Item sgAC5sym = new SGAddressSymbol1(); sgAC5sym.MoveToWorld(new Point3D(from.Location.X + 2, from.Location.Y + 2, from.Location.Z), from.Map); } if (addcode5 == 2) { Item sgAC5sym = new SGAddressSymbol2(); sgAC5sym.MoveToWorld(new Point3D(from.Location.X + 2, from.Location.Y + 2, from.Location.Z), from.Map); } if (addcode5 == 3) { Item sgAC5sym = new SGAddressSymbol3(); sgAC5sym.MoveToWorld(new Point3D(from.Location.X + 2, from.Location.Y + 2, from.Location.Z), from.Map); } if (addcode5 == 4) { Item sgAC5sym = new SGAddressSymbol4(); sgAC5sym.MoveToWorld(new Point3D(from.Location.X + 2, from.Location.Y + 2, from.Location.Z), from.Map); } if (addcode5 == 5) { Item sgAC5sym = new SGAddressSymbol5(); sgAC5sym.MoveToWorld(new Point3D(from.Location.X + 2, from.Location.Y + 2, from.Location.Z), from.Map); } SGCore.SGList.Add(new SGEntry(from.X, from.Y, from.Z, sgdir, sgaddonid, SGCore.SGSystemEnabled, false, false, SGCore.SGSystemHideGate, "Nobody", sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5)); from.Z = from.Z + 5; from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5)); if (!SGCore.SGSystemEnabled) { for (int i = 0; i < SGCore.SGList.Count; i++) { SGEntry sge = (SGEntry)SGCore.SGList[i]; { sge.SGCanBeUsed = false; sge.SGBeingUsed = false; sge.SGEnergy = false; } } // Hue Control Crystals To DISABLED ArrayList SGADevice = new ArrayList(); foreach (Item item in World.Items.Values) { if (item is SGActivatorDevice) { SGADevice.Add(item); } } foreach (Item item in SGADevice) { (item).Hue = 39; } } else if (SGCore.SGSystemEnabled) { for (int i = 0; i < SGCore.SGList.Count; i++) { SGEntry sge = (SGEntry)SGCore.SGList[i]; { sge.SGCanBeUsed = true; sge.SGBeingUsed = false; sge.SGEnergy = false; } } // Hue Control Crystals To ENABLED ArrayList SGADevice = new ArrayList(); foreach (Item item in World.Items.Values) { if (item is SGActivatorDevice) { SGADevice.Add(item); } } foreach (Item item in SGADevice) { (item).Hue = 2963; } } } else { // duped gate address from.SendMessage(88, "ABORTED !!!, This gate address is already used on this facet, Try a different address for your gate."); from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5)); } } break; case 16: { from.CloseGump(typeof(SGGumpAdministrator)); if (!SGCore.SGSystemEnabled) { SGCore.SGSystemEnabled = true; from.SendMessage(77, "Stargate System enabled."); for (int i = 0; i < SGCore.SGList.Count; i++) { SGEntry sge = (SGEntry)SGCore.SGList[i]; { sge.SGCanBeUsed = true; sge.SGBeingUsed = false; sge.SGEnergy = false; } } // Hue Control Crystals To NORMAL ArrayList SGADevice = new ArrayList(); foreach (Item item in World.Items.Values) { if (item is SGActivatorDevice) { SGADevice.Add(item); } } foreach (Item item in SGADevice) { (item).Hue = 2963; } } else { SGCore.SGSystemEnabled = false; from.SendMessage(77, "Stargate System disabled, any open gates will close down after they are used."); for (int i = 0; i < SGCore.SGList.Count; i++) { SGEntry sge = (SGEntry)SGCore.SGList[i]; { sge.SGCanBeUsed = false; sge.SGBeingUsed = false; sge.SGEnergy = false; } } // Hue Control Crystals To DISABLED ArrayList SGADevice = new ArrayList(); foreach (Item item in World.Items.Values) { if (item is SGActivatorDevice) { SGADevice.Add(item); } } foreach (Item item in SGADevice) { (item).Hue = 39; } } from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5)); } break; case 17: { from.CloseGump(typeof(SGGumpAdministrator)); from.SendMessage(77, "Saving XML File, Overwriting old XML file..."); SGCore.SGTriggerSave(); from.SendMessage(77, "Save Done."); from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5)); } break; case 18: { from.CloseGump(typeof(SGGumpAdministrator)); SGCore.SGTriggerLoad(); from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5)); } break; case 19: { from.SendMessage(77, "Exit Stargate Admin"); from.CloseGump(typeof(SGGumpAdministrator)); } break; case 20: { from.SendMessage(77, "Administrator Help & Information Option Selected..."); from.CloseGump(typeof(SGGumpAdministratorInfo)); from.SendGump(new SGGumpAdministratorInfo()); from.CloseGump(typeof(SGGumpAdministrator)); from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5)); } break; case 21: { from.CloseGump(typeof(SGGumpAdministrator)); from.SendMessage(77, "Generate HTML Address File..."); SGCore.SGGenHTML(); from.SendMessage(77, "Done."); from.SendGump(new SGGumpAdministrator(from, sggatecounter, sgaddonid, sgdir, sgplatname, facetid, addcode1, addcode2, addcode3, addcode4, addcode5)); } break; } }