public async Task RemoveZoneFlag(string zoneName, params string[] flagNames) { IZone zone = await this.GetZoneOrReplyAsync(zoneName); if (zone.IsValid()) { ZoneFlags parsedFlags = ParseZoneFlags(flagNames); IEnumerable <string> parsedFlagNames = Enum.GetValues(typeof(ZoneFlags)).Cast <ZoneFlags>() .Where(value => value != ZoneFlags.None) .Where(value => parsedFlags.HasFlag(value)) .Select(flag => flag.ToString()); if (parsedFlags == ZoneFlags.None) { await ReplyErrorAsync("No valid flags were specified."); } else { zone.Flags &= ~parsedFlags; await Db.UpdateZoneAsync(zone); await ReplySuccessAsync($"Flag(s) {StringUtilities.ConjunctiveJoin(parsedFlagNames.Select(name => name.ToBold()))} successfully unset for {zone.GetFullName().ToBold()}."); } } }
private async Task <IEnumerable <string> > GetMissingRolesInZoneIdeasAsync() { // Checks for roles that are unfulfilled for a given zone List <string> ideas = new List <string>(); string query = @"SELECT Zones.id AS zone_id1, Zones.name AS zone_name, Zones.flags AS zone_flags, Roles.id AS role_id1, Roles.name AS role_name FROM Zones, Roles WHERE NOT EXISTS(SELECT * FROM SpeciesRoles WHERE role_id = role_id1 AND species_id IN (SELECT species_id FROM SpeciesZones WHERE zone_id = zone_id1));" ; using (SQLiteCommand cmd = new SQLiteCommand(query)) { foreach (DataRow row in await Db.GetRowsAsync(cmd)) { ZoneFlags zoneFlags = ZoneFlags.None; if (!row.IsNull("zone_flags")) { zoneFlags = (ZoneFlags)row.Field <long>("zone_flags"); } if (!zoneFlags.HasFlag(ZoneFlags.Retired)) { string zoneName = row.Field <string>("zone_name"); string roleName = row.Field <string>("role_name"); ideas.Add($"{ZoneUtilities.GetFullName(zoneName).ToBold()} does not have any {roleName.ToTitle().ToPlural().ToBold()}. Why not fill this role?"); } } } return(ideas.ToArray()); }
public void SetFlags(string flags) { if (!string.IsNullOrEmpty(flags)) { flags = flags.Trim().Replace(" ", ""); this.Flags = (ZoneFlags)Enum.Parse(typeof(ZoneFlags), flags); } }
public Zone(int id, int areaId, int mapId, RectangleF bounds, ZoneFlags flags, string name, string dataName, Overlay[] overlays) { Id = id; AreaId = areaId; MapId = mapId; Bounds = bounds; Flags = flags; Name = name; DataName = dataName; Overlays = new ReadOnlyCollection <Overlay>(overlays); }
public WorldZone(string name = null, ZoneFlags flags = (ZoneFlags)0) { this.Name = name; this.Flags = flags; this.Points = new List <Vector2>(); this.Spawns = new List <Vector3>(); this.Internal = new List <WorldZone>(); this.ForbiddenCommand = new string[0]; this.Message_OnEnter = new string[0]; this.Message_OnLeave = new string[0]; this.WarpZone = null; this.WarpTime = 0L; }
/// <summary> /// Called during certain runtime operations. Primarily used for debugging Padarn's internal systems. /// </summary> /// <param name="info"></param> /// <param name="zoneMask">The zone associated with the incoming information</param> public virtual void LogRuntimeInfo(ZoneFlags zoneMask, string info) { Debug.WriteLine(string.Format("Zone {0} : {1}", zoneMask.ToString(), info)); }
void ILogProvider.LogRuntimeInfo(ZoneFlags zoneMask, string info) { }
private static void RemoveZoneFlag(ZoneDefinition zone, ZoneFlags flag) { zone.flags &= ~flag; }
private static void AddZoneFlag(ZoneDefinition zone, ZoneFlags flag) { zone.flags |= flag; }
private bool HasZoneFlag(Zone zone, ZoneFlags flag) { if ((disabledFlags & flag) == flag) return false; return (zone.Info.flags & ~zone.disabledFlags & flag) == flag; }
private bool HasPlayerFlag(BasePlayer player, ZoneFlags flag) { if ((disabledFlags & flag) == flag) return false; ZoneFlags tags; if (!playerTags.TryGetValue(player, out tags)) return false; return (tags & flag) == flag; }
private void RemoveDisabledFlag(string flagString) { try { var flag = (ZoneFlags)Enum.Parse(typeof(ZoneFlags), flagString, true); disabledFlags &= ~flag; } catch { } }
public static bool And(this ZoneFlags mask, ZoneFlags matchMask) { return (mask & matchMask) != ZoneFlags.None; }
private static bool HasAnyFlag(ZoneFlags flags, ZoneFlags flag) { return (flags & flag) != ZoneFlags.None; }