public void QueueEvent(EventSpecial specialGroup) { if (_queuedEvent == null) { _queuedEvent = GetEvent(specialGroup); } }
protected Event() { this.chance = Event.defaultChance; this.reward = null; this.filters = null; this.eventGroup = EventGroup.None; this.specialGroup = EventSpecial.None; }
public Event(EventSpecial specialGroup, string messageLink, Reward reward, EventFilters filters, int chance) { this.specialGroup = specialGroup; this.messageLink = messageLink; this.reward = reward; this.filters = filters; this.chance = chance; this.eventGroup = EventGroup.None; }
public static void AddByLink(EventSpecial specialGroup, string messageLink, Reward reward = null, EventFilters filters = null, int chance = Event.defaultChance) { if (reward == null) { reward = Reward.none; } if (filters == null) { filters = EventFilters.none; } Event e = new Event(specialGroup, messageLink, reward, filters, chance); library.Add(e); }
public Event GetEvent(EventSpecial specialGroup) { Event e = Destiny.FindEvent(this, specialGroup); if (e == null) { ConsoleEx.Log("ERROR: No event found in destiny. Emptying queue and retrying."); blockedEvents.Clear(); e = Destiny.FindEvent(this, specialGroup); if (e == null) { ConsoleEx.Log("ERROR: No suitable event. Please check event filters for special event " + Enum.GetName(typeof(EventSpecial), specialGroup) + "."); return(null); } } return(e); }
public static Event FindEvent(Pilot target, EventSpecial specialGroup) { List <Event> filteredLibrary = new List <Event>(); foreach (Event e in library) { if (specialGroup == e.specialGroup && e.filters.IsGood(target) && !target.blockedEvents.Contains(e)) { filteredLibrary.Add(e); } } if (filteredLibrary.Count == 0) { return(null); } else { return(filteredLibrary[Random.Get(0, filteredLibrary.Count)]); } }
public static void Add(EventSpecial specialGroup, string message, Reward reward = null, EventFilters filters = null, int chance = Event.defaultChance) { string link = Localization.Add(message); AddByLink(specialGroup, link, reward, filters); }
public void RunEvent(EventSpecial specialGroup) { RunEvent(GetEvent(specialGroup)); }