bool DeleteZone(Player p, Vec3S32[] marks, object state, byte type, byte extType) { Level lvl = p.level; bool foundDel = false; Vec3S32 P = marks[0]; for (int i = 0; i < lvl.ZoneList.Count; i++) { Level.Zone zn = lvl.ZoneList[i]; if (P.X < zn.smallX || P.X > zn.bigX || P.Y < zn.smallY || P.Y > zn.bigY || P.Z < zn.smallZ || P.Z > zn.bigZ) { continue; } if (zn.Owner.Length >= 3 && zn.Owner.StartsWith("grp")) { string grpName = zn.Owner.Substring(3); if (p.Rank < Group.Find(grpName).Permission) { continue; } } else if (zn.Owner != "" && !zn.Owner.CaselessEq(p.name)) { Group group = Group.findPlayerGroup(zn.Owner); if (p.Rank < group.Permission) { continue; } } LevelDB.DeleteZone(lvl.name, zn); lvl.ZoneList.RemoveAt(i); i--; Player.Message(p, "Zone deleted for &b" + zn.Owner); foundDel = true; } if (!foundDel) { Player.Message(p, "No zones found to delete."); } return(false); }
internal static void DeleteWhere(Player p, Predicate <Level.Zone> filter) { int count = p.level.ZoneList.Count, removed = 0; for (int i = count - 1; i >= 0; i--) { Level.Zone zone = p.level.ZoneList[i]; if (!filter(zone)) { continue; } LevelDB.DeleteZone(p.level.name, zone); removed++; Player.Message(p, "Zone deleted for &b" + zone.Owner); p.level.ZoneList.Remove(p.level.ZoneList[i]); } Player.Message(p, "Removed {0} zone{1}.", removed, count == 1 ? "s" : ""); }