private void OnJobTaken(DV.Logic.Job.Job job, bool takenViaGame)
    {
        job.JobCompleted += OnJobCompleted;
        Job sJob = jobs.FirstOrDefault(j => j.GameId == job.ID);

        if (sJob != null && sJob.CanTakeJob)
        {
            SendJobTaken(sJob.Id);
            sJob.IsTakenByLocalPlayer = true;
            sJob.IsTaken = true;
        }
    }
    private void OnJobCompleted(DV.Logic.Job.Job job)
    {
        Job sJob = jobs.FirstOrDefault(j => j.GameId == job.ID);

        if (sJob != null && !sJob.IsCompleted && sJob.IsTakenByLocalPlayer)
        {
            SendJobCompleted(sJob.Id);
            sJob.IsCompleted = true;
            if (NetworkManager.IsHost())
            {
                UpdateChainSaveData(sJob.ChainId);
            }
        }
    }
    private void OnNextJobInChainGenerated(StaticJobDefinition jobDef, DV.Logic.Job.Job job)
    {
        if (NetworkManager.IsHost())
        {
            Job data    = jobs.FirstOrDefault(j => j.Definition == jobDef);
            Job prevJob = jobs.FirstOrDefault(j => j.ChainId == data.ChainId && j.IsCurrentJob);
            prevJob.IsCurrentJob = false;
            data.GameId          = job.ID;
            data.IsCurrentJob    = true;
            SendNextJobGenerated(data);
        }

        Main.Log("Register job taken event");
        job.JobTaken += OnJobTaken;
        Main.Log("Job fully loaded");
    }
 private void OnJobExpired(DV.Logic.Job.Job job)
 {
     job.JobTaken -= OnJobTaken;
 }