public static void GenerateJobs(SocietiesGroupType societyGroupType) { SocietyJob societyJob = null; switch (societyGroupType) { #region Adventurer's Lodge case SocietiesGroupType.AdventurersLodge: break; #endregion #region Artificer's Enclave case SocietiesGroupType.ArtificersEnclave: //Alchemy Easy societyJob = new SocietyJob(); societyJob.m_SocietiesGroupType = SocietiesGroupType.ArtificersEnclave; societyJob.m_JobType = SocietyJob.JobType.CraftItem; societyJob.m_Expiration = Societies.NextJobsAdded + TimeSpan.FromHours(24); societyJob.m_PointValue = 2; societyJob.m_DestinationMobile = typeof(Alchemist); societyJob.m_DestinationMobileName = "Alchemist"; societyJob.m_DestinationTown = Towns.GetRandomTown(); #region Potential Jobs switch (Utility.RandomMinMax(1, 1)) { case 1: societyJob.m_PrimaryType = typeof(GreaterHealPotion); societyJob.m_PrimaryTypeName = "Greater Heal Potions"; societyJob.m_TargetNumber = Utility.RandomList(350, 375, 400, 425, 450); societyJob.m_TurnInRequirementAmount = societyJob.m_TargetNumber; societyJob.m_IconItemId = 3852; societyJob.m_IconOffsetX = 55; societyJob.m_IconOffsetY = 40; break; } #endregion Societies.m_SocietyJobs.Add(societyJob); //Alchemy Hard societyJob = new SocietyJob(); societyJob.m_SocietiesGroupType = SocietiesGroupType.ArtificersEnclave; societyJob.m_JobType = SocietyJob.JobType.CraftItem; societyJob.m_Expiration = Societies.NextJobsAdded + TimeSpan.FromHours(24); societyJob.m_PointValue = 4; societyJob.m_DestinationMobile = typeof(Alchemist); societyJob.m_DestinationMobileName = "Alchemist"; societyJob.m_DestinationTown = Towns.GetRandomTown(); #region Potential Jobs switch (Utility.RandomMinMax(1, 1)) { case 1: societyJob.m_PrimaryType = typeof(LethalPoisonPotion); societyJob.m_PrimaryTypeName = "Lethal Poison Potions"; societyJob.m_TargetNumber = Utility.RandomList(40, 45, 50, 55, 60); societyJob.m_TurnInRequirementAmount = societyJob.m_TargetNumber; societyJob.m_IconItemId = 3850; societyJob.m_IconOffsetX = 55; societyJob.m_IconOffsetY = 40; break; } #endregion Societies.m_SocietyJobs.Add(societyJob); //----- //Inscription Easy societyJob = new SocietyJob(); societyJob.m_SocietiesGroupType = SocietiesGroupType.ArtificersEnclave; societyJob.m_JobType = SocietyJob.JobType.CraftItem; societyJob.m_Expiration = Societies.NextJobsAdded + TimeSpan.FromHours(24); societyJob.m_PointValue = 2; societyJob.m_DestinationMobile = typeof(Scribe); societyJob.m_DestinationMobileName = "Scribe"; societyJob.m_DestinationTown = Towns.GetRandomTown(); #region Potential Jobs switch (Utility.RandomMinMax(1, 1)) { case 1: SpellScroll spellScroll = SpellScroll.GetRandomSpellScroll(6); if (spellScroll == null) { return; } societyJob.m_PrimaryType = spellScroll.GetType(); societyJob.m_PrimaryTypeName = Utility.Capitalize(spellScroll.Name) + "s"; societyJob.m_TargetNumber = Utility.RandomList(150, 175, 200, 225, 250); societyJob.m_TurnInRequirementAmount = societyJob.m_TargetNumber; societyJob.m_IconItemId = spellScroll.IconItemId; societyJob.m_IconHue = spellScroll.IconHue; societyJob.m_IconOffsetX = spellScroll.IconOffsetX; societyJob.m_IconOffsetY = spellScroll.IconOffsetY; spellScroll.Delete(); break; } #endregion Societies.m_SocietyJobs.Add(societyJob); //Inscription Hard societyJob = new SocietyJob(); societyJob.m_SocietiesGroupType = SocietiesGroupType.ArtificersEnclave; societyJob.m_JobType = SocietyJob.JobType.CraftItem; societyJob.m_Expiration = Societies.NextJobsAdded + TimeSpan.FromHours(24); societyJob.m_PointValue = 4; societyJob.m_DestinationMobile = typeof(Scribe); societyJob.m_DestinationMobileName = "Scribe"; societyJob.m_DestinationTown = Towns.GetRandomTown(); #region Potential Jobs switch (Utility.RandomMinMax(1, 1)) { case 1: SpellScroll spellScroll = null; double randomResult = Utility.RandomDouble(); if (randomResult <= .50) { spellScroll = SpellScroll.GetRandomSpellScroll(7); societyJob.m_TargetNumber = Utility.RandomList(12, 14, 16, 18, 20); } else { spellScroll = SpellScroll.GetRandomSpellScroll(8); societyJob.m_TargetNumber = Utility.RandomList(6, 7, 8, 9, 10); } if (spellScroll == null) { return; } societyJob.m_PrimaryType = spellScroll.GetType(); societyJob.m_PrimaryTypeName = Utility.Capitalize(spellScroll.Name) + "s"; societyJob.m_TurnInRequirementAmount = societyJob.m_TargetNumber; societyJob.m_IconItemId = spellScroll.IconItemId; societyJob.m_IconHue = spellScroll.IconHue; societyJob.m_IconOffsetX = spellScroll.IconOffsetX; societyJob.m_IconOffsetY = spellScroll.IconOffsetY; spellScroll.Delete(); break; } #endregion Societies.m_SocietyJobs.Add(societyJob); break; #endregion #region Farmer's Cooperative case SocietiesGroupType.FarmersCooperative: break; #endregion #region Fisherman's Circle case SocietiesGroupType.FishermansCircle: break; #endregion #region Monster Hunter's Society case SocietiesGroupType.MonsterHuntersSociety: break; #endregion #region Seafarer's League case SocietiesGroupType.SeafarersLeague: break; #endregion #region Smithing Order case SocietiesGroupType.SmithingOrder: break; #endregion #region Thieves Guild case SocietiesGroupType.ThievesGuild: break; #endregion #region Tradesman Union case SocietiesGroupType.TradesmanUnion: break; #endregion #region Zoological Foundation case SocietiesGroupType.ZoologicalFoundation: break; #endregion } }
public SocietyJobPlayerProgress(SocietyJob job) { m_Job = job; }
public static SocietyJobPlayerProgress GetSocietiesJobPlayerProgress(PlayerMobile player, SocietyJob job) { SocietyJobPlayerProgress jobPlayerProgress = null; if (player == null) { return(jobPlayerProgress); } if (job == null) { return(jobPlayerProgress); } CheckCreateSocietiesPlayerSettings(player); foreach (SocietyJobPlayerProgress jobPlayerProgressEntry in player.m_SocietiesPlayerSettings.m_JobProgress) { if (jobPlayerProgressEntry == null) { continue; } if (jobPlayerProgressEntry.m_Job == job) { return(jobPlayerProgressEntry); } } return(jobPlayerProgress); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); CreateSocietyData(); //Version 0 if (version >= 0) { m_Player = reader.ReadMobile() as PlayerMobile; int jobProgressCount = reader.ReadInt(); for (int a = 0; a < jobProgressCount; a++) { SocietyJob job = reader.ReadItem() as SocietyJob; SocietiesJobContract jobContract = reader.ReadItem() as SocietiesJobContract; double primaryProgress = reader.ReadDouble(); double secondaryProgress = reader.ReadDouble(); if (job == null) { continue; } if (job.Deleted) { continue; } SocietyJobPlayerProgress jobProgress = new SocietyJobPlayerProgress(job); jobProgress.m_JobContract = jobContract; jobProgress.m_ProgressAmount = primaryProgress; jobProgress.m_TurnedInAmount = secondaryProgress; m_JobProgress.Add(jobProgress); } int recordedSocietyGroupDataCount = reader.ReadInt(); for (int a = 0; a < recordedSocietyGroupDataCount; a++) { SocietiesGroupType societyGroupType = (SocietiesGroupType)reader.ReadInt(); int pointsAvailable = reader.ReadInt(); int monthlyPoints = reader.ReadInt(); int lifetimePoints = reader.ReadInt(); int pointsSpent = reader.ReadInt(); foreach (SocietyGroupPlayerData societyGroupPlayerData in m_SocietyPlayerData) { if (societyGroupPlayerData.m_SocietyGroupType == societyGroupType) { societyGroupPlayerData.m_PointsAvailable = pointsAvailable; societyGroupPlayerData.m_MontlyPoints = monthlyPoints; societyGroupPlayerData.m_LifetimePoints = lifetimePoints; societyGroupPlayerData.m_PointsSpent = pointsSpent; break; } } } } //----- if (m_Player != null) { m_Player.m_SocietiesPlayerSettings = this; } else { Delete(); } }
public static void CheckForExpiredSocietyJobs() { List <SocietyJob> m_ExpiredJobs = new List <SocietyJob>(); Queue m_Queue = new Queue(); foreach (SocietyJob societyJob in m_SocietyJobs) { if (societyJob.m_Expiration <= DateTime.UtcNow) { m_ExpiredJobs.Add(societyJob); m_Queue.Enqueue(societyJob); } } foreach (Mobile mobile in World.Mobiles.Values) { if (!mobile.Player) { continue; } PlayerMobile player = mobile as PlayerMobile; CheckCreateSocietiesPlayerSettings(player); int expiredJobCount = 0; foreach (SocietyJob societyJob in m_ExpiredJobs) { for (int a = 0; a < player.m_SocietiesPlayerSettings.m_JobProgress.Count; a++) { SocietyJobPlayerProgress jobPlayerProgress = player.m_SocietiesPlayerSettings.m_JobProgress[a]; if (jobPlayerProgress == null) { continue; } if (jobPlayerProgress.m_Job == societyJob) { if (jobPlayerProgress.m_JobContract != null) { jobPlayerProgress.m_JobContract.JobStatus = SocietiesJobContract.JobStatusType.Expired; } player.m_SocietiesPlayerSettings.m_JobProgress.RemoveAt(a); expiredJobCount++; break; } } } if (expiredJobCount > 0) { player.SendMessage("One or more of your society job contracts have expired."); } } while (m_Queue.Count > 0) { SocietyJob societyJob = (SocietyJob)m_Queue.Dequeue(); societyJob.Delete(); } }