private static void U4MoonGen_DeleteOld() { List <Item> U4_list = new List <Item>(); List <Item> Public_list = new List <Item>(); int u4count = 0; int publiccount = 0; foreach (Item item in World.Items.Values) { if (item is UltimaMoongate_U4) { U4_list.Add(item); } else if (item is PublicMoongate) { Public_list.Add(item); } } // Only delete UltimaMoongates if they are in the moongate circles foreach (Item item in U4_list) { for (int x = 0; x < 8; x++) { if (item.GetWorldLocation() == UltimaMoongate_U4_Gate.MoonPhase2Destination((MoonPhase)x)) { item.Delete(); u4count++; break; } } } // Only delete PublicMoongates if they are in Trammel or Felucca -and- in the moongate circles foreach (Item item in Public_list) { if ((item.Map == Map.Trammel) || (item.Map == Map.Felucca)) { for (int x = 0; x < 8; x++) { if (item.GetWorldLocation() == UltimaMoongate_U4_Gate.MoonPhase2Destination((MoonPhase)x)) { item.Delete(); publiccount++; break; } } } } if (U4_list.Count > 0) { World.Broadcast(0x35, true, "{0} UltimaMoongates removed.", u4count); } if (Public_list.Count > 0) { World.Broadcast(0x35, true, "{0} PublicMoongates removed.", publiccount); } }
public static void U4MoonGen_OnCommand(CommandEventArgs e) { U4MoonGen_DeleteOld(); for (int x = 0; x < 8; x++) { Item felGate = new UltimaMoongate_U4((MoonPhase)x); felGate.MoveToWorld(UltimaMoongate_U4_Gate.MoonPhase2Destination((MoonPhase)x), Map.Felucca); Item tramGate = new UltimaMoongate_U4((MoonPhase)x); tramGate.MoveToWorld(UltimaMoongate_U4_Gate.MoonPhase2Destination((MoonPhase)x), Map.Trammel); } }