public void OnStateEnter() { Chat.WriteLine("ReformState::OnStateEnter"); _phase = ReformPhase.MissionExitBuffer; _reformStartedTime = Time.NormalTime; if (Team.IsLeader) { DynelManager.DynelSpawned += OnDynelSpawned; DynelManager.CharInPlay += OnCharInPlay; } }
public void Tick() { if (!Reform.IsLeader) { return; } //This gives the bots time to run out gracefully instead of being booted if (_phase == ReformPhase.MissionExitBuffer && Time.NormalTime > _reformStartedTime + DisbandDelay) { _teamCache = Team.Members.Select(x => x.Identity).ToArray(); Team.Disband(); _phase = ReformPhase.Disbanding; Chat.WriteLine("ReformPhase.Disbanding"); } if (_phase == ReformPhase.Disbanding && !Team.IsInTeam) { foreach (SimpleChar player in DynelManager.Players.Where(x => _teamCache.Contains(x.Identity) && x.IsInPlay)) { InvitePlayer(player.Identity); } _phase = ReformPhase.AwaitingTeammembers; Chat.WriteLine("ReformPhase.AwaitingTeammembers"); } if (_phase == ReformPhase.AwaitingTeammembers && !_invitedPastTeamMembers && Time.NormalTime > _reformStartedTime + InviteAllDelay) { foreach (Identity oldTeammate in _teamCache) { InvitePlayer(oldTeammate); } _invitedPastTeamMembers = true; } }
public void Tick() { if (_phase == ReformPhase.PostReformBuffer && Time.NormalTime > _reformFinishedTime + PostReformBuffer) { if (Team.IsInTeam && Team.IsRaid) { APFBuddy.Start(); return; } else { Chat.WriteLine("Reform failed? Expected to be in raid."); APFBuddy.FSM.Fire(Trigger.TeamReformFailed); return; } } if (_phase == ReformPhase.Disbanding) { _teamCache = Team.Members.Select(x => x.Identity).ToArray(); Team.Disband(); _phase = ReformPhase.AwaitingZoneChange; Chat.WriteLine("ReformPhase.AwaitingZoneChange"); } if (_phase == ReformPhase.AwaitingZoneChange && Playfield.ModelIdentity.Instance == Constants.APFHubId) { _zoneChangedTime = Time.NormalTime; _phase = ReformPhase.PreReformBuffer; Chat.WriteLine("ReformPhase.PreReformBuffer"); } if (_phase == ReformPhase.PreReformBuffer && Time.NormalTime > _zoneChangedTime + PreReformBuffer) { _phase = ReformPhase.BulkInvite; Chat.WriteLine("ReformPhase.BulkInvite"); } if (_phase == ReformPhase.BulkInvite) { foreach (SimpleChar player in DynelManager.Players.Where(x => _teamCache.Contains(x.Identity) && x.IsInPlay)) { InvitePlayer(player.Identity); } _phase = ReformPhase.AwaitingTeammembers; Chat.WriteLine("ReformPhase.AwaitingTeammembers"); } if (_phase == ReformPhase.AwaitingTeammembers) { if (!_invitedPastTeamMembers && Time.NormalTime > _reformStartedTime + InviteAllDelay) { foreach (Identity oldTeammate in _teamCache) { InvitePlayer(oldTeammate); } _invitedPastTeamMembers = true; } if (Time.NormalTime < _reformStartedTime + ReformTimeout && Team.Members.Count < 6 && _teamCache.Except(Team.Members.Select(x => x.Identity).ToArray()).Any()) { return; } if (Time.NormalTime > _reformStartedTime + ReformTimeout) { Chat.WriteLine($"Reform timed out.."); } else { Chat.WriteLine("Reform complete."); } _phase = ReformPhase.PostReformBuffer; _reformFinishedTime = Time.NormalTime; Team.ConvertToRaid(); } }