/// <summary> /// Запускает миссию клана /// </summary> private void StartMission(ClanMission mission, long clanId) { if (!HasActiveMission()) { _clanCourtyard.ShowMarkers(); } mission.Start(); ClanManager.SetAuthority(clanId, -MissionMenuHandler.NEEDED_AUTHORITY); API.sendChatMessageToAll($"~b~\"{ClanManager.GetClanName(clanId)}\" ~w~запустили миссию ~b~\"{mission.Place.GetDescription()}\""); ActionHelper.SetAction(MISSION_DURATION * 3600000, () => FinishMission(clanId)); }
/// <summary> /// Создает миссию /// </summary> private static ClanMission CreateMission() { MissionPlace place; var places = Enum.GetValues(typeof(MissionPlace)); do { place = (MissionPlace)places.GetValue(ActionHelper.Random.Next(places.Length)); } while (place == MissionPlace.Unknown || Missions.Values.Any(e => e.Place == place)); var mission = new ClanMission { Place = place }; return(mission); }