public override void OnResponse(NetState sender, RelayInfo info) { if (m_Player == null) { return; } bool closeGump = true; if (m_Player == null) { return; } if (m_SocietiesJobContract == null) { m_Player.SendMessage("That job contract is no longer accessible"); return; } if (m_SocietiesJobContract.Deleted) { m_Player.SendMessage("That job contract is no longer accessible"); return; } if (m_SocietiesJobContract.m_Job == null) { m_Player.SendMessage("That job is no longer available"); return; } if (m_SocietiesJobContract.m_Job.Deleted) { m_Player.SendMessage("That job is no longer available"); return; } SocietyJob societyJob = m_SocietiesJobContract.m_Job; SocietyJobPlayerProgress jobPlayerProgress = Societies.GetSocietiesJobPlayerProgress(m_Player, societyJob); switch (info.ButtonID) { //Guide case 1: closeGump = false; break; //Turn In case 2: if (m_SocietiesJobContract.m_Player != m_Player) { m_Player.SendMessage("That job contract does not belong to you."); } else if (societyJob.m_Expiration <= DateTime.UtcNow) { m_Player.SendMessage("That job contract has expired."); } else if (jobPlayerProgress != null) { if (jobPlayerProgress.m_ProgressAmount < societyJob.m_TargetNumber) { m_Player.SendMessage("You have not completed all of the requirements of that contract yet."); } else if (societyJob.m_DestinationTown != null) { if (m_Player.Region != societyJob.m_DestinationTown.region) { m_Player.SendMessage("You must be within " + societyJob.m_DestinationTown.TownName + " to turn in that contract."); } else { Mobile matchingMobile = null; IPooledEnumerable m_NearbyMobiles = m_Player.Map.GetMobilesInRange(m_Player.Location, 8); int closestMobile = 10000; foreach (Mobile mobile in m_NearbyMobiles) { if (!mobile.Alive) { continue; } if (mobile.Hidden) { continue; } if (mobile.GetType() == societyJob.m_DestinationMobile) { int distance = Utility.GetDistance(m_Player.Location, mobile.Location); if (distance < closestMobile) { matchingMobile = mobile; closestMobile = distance; } } } m_NearbyMobiles.Free(); if (matchingMobile != null) { bool validCompletion = societyJob.TurnIn(m_Player, matchingMobile); if (validCompletion) { societyJob.Complete(m_Player); } } else { m_Player.SendMessage("You must be near a " + societyJob.m_DestinationMobileName + " in order to turn in that contract."); } } } } closeGump = false; break; } if (!closeGump) { m_Player.CloseGump(typeof(SocitiesJobContractGump)); m_Player.SendGump(new SocitiesJobContractGump(m_Player, m_SocietiesJobContract)); } else { m_Player.SendSound(CloseGumpSound); } }
public SocietiesJobBoardGump(PlayerMobile player, SocietiesGroupType societiesGroup, SocietiesGroupPageDisplayType societiesGroupPageDisplay, int rewardPage) : base(10, 10) { if (player == null) { return; } m_Player = player; m_SocietiesGroup = societiesGroup; m_SocietiesGroupPageDisplay = societiesGroupPageDisplay; m_RewardPage = rewardPage; Societies.CheckCreateSocietiesPlayerSettings(m_Player); string societiesGroupName = Societies.GetSocietyGroupName(m_SocietiesGroup); int societiesGroupTextHue = Societies.GetSocietyGroupTextHue(m_SocietiesGroup); SocietyGroupPlayerData societyGroupPlayerData = m_Player.m_SocietiesPlayerSettings.GetSocietyGroupPlayerData(m_SocietiesGroup); if (societyGroupPlayerData == null) { return; } int availablePoints = societyGroupPlayerData.m_PointsAvailable; int monthlyPoints = societyGroupPlayerData.m_MontlyPoints; int lifetimePoints = societyGroupPlayerData.m_LifetimePoints; int pointsSpent = societyGroupPlayerData.m_PointsSpent; int WhiteTextHue = 2499; #region Background Images AddImage(5, 5, 103); AddImage(140, 5, 103); AddImage(266, 5, 103); AddImage(140, 92, 103); AddImage(5, 92, 103); AddImage(266, 92, 103); AddImage(140, 180, 103); AddImage(5, 180, 103); AddImage(266, 180, 103); AddImage(140, 264, 103); AddImage(5, 264, 103); AddImage(266, 264, 103); AddImage(400, 5, 103); AddImage(400, 92, 103); AddImage(400, 180, 103); AddImage(400, 265, 103); AddImage(530, 5, 103); AddImage(530, 92, 103); AddImage(530, 180, 103); AddImage(530, 265, 103); AddImage(140, 353, 103); AddImage(5, 353, 103); AddImage(266, 353, 103); AddImage(400, 353, 103); AddImage(530, 353, 103); AddBackground(19, 22, 643, 421, 5120); AddBackground(15, 20, 653, 419, 9380); #endregion AddButton(14, 14, 2094, 2095, 1, GumpButtonType.Reply, 0); AddLabel(12, 2, 149, "Guide"); AddLabel(287, 0, WhiteTextHue, "Societies Job Board"); switch (m_SocietiesGroupPageDisplay) { #region Jobs case SocietiesGroupPageDisplayType.Jobs: #region Header Images AddImage(462, 60, 103); AddImage(322, 60, 103); AddImage(102, 60, 103); AddImage(205, 60, 103); AddImage(102, 48, 103); AddImage(233, 48, 103); AddImage(325, 48, 103); AddImage(462, 48, 103); AddImage(112, 58, 5104, 2052); AddImage(191, 58, 5104, 2052); AddImage(234, 58, 5104, 2052); AddImage(298, 58, 5104, 2052); AddImage(347, 58, 5104, 2052); AddImage(504, 58, 5104, 2052); AddImage(431, 58, 5104, 2052); #endregion List <KeyValuePair <PlayerMobile, int> > monthlyRanks = Societies.GetSocietyGroupMonthlyRanks(m_SocietiesGroup); List <KeyValuePair <PlayerMobile, int> > lifetimeRanks = Societies.GetSocietyGroupMonthlyRanks(m_SocietiesGroup); int monthlyRank = monthlyRanks.Count; int lifetimeRank = lifetimeRanks.Count; for (int a = 0; a < monthlyRanks.Count; a++) { if (monthlyRanks[a].Key == m_Player) { monthlyRank = a + 1; break; } } for (int a = 0; a < lifetimeRanks.Count; a++) { if (lifetimeRanks[a].Key == m_Player) { lifetimeRank = a + 1; break; } } string monthlyRankText = monthlyRank.ToString() + Utility.DetermineNumberSuffix(monthlyRank); string lifetimeRankText = lifetimeRank.ToString() + Utility.DetermineNumberSuffix(lifetimeRank); string timeUntilNewJobs = Utility.CreateTimeRemainingString(DateTime.UtcNow, Societies.NextJobsAdded, true, true, true, true, false); string monthlyScoreText = monthlyPoints.ToString() + " Points (" + monthlyRankText + ")"; string lifetimeScoreText = lifetimePoints.ToString() + " Points (" + lifetimeRankText + ")"; AddImage(203, 40, 1141); AddLabel(Utility.CenteredTextOffset(350, societiesGroupName), 42, societiesGroupTextHue, societiesGroupName); AddLabel(125, 67, 149, "New Jobs Available In"); AddLabel(Utility.CenteredTextOffset(190, timeUntilNewJobs), 87, WhiteTextHue, timeUntilNewJobs); AddLabel(129, 114, societiesGroupTextHue, availablePoints.ToString() + " Points in Society"); AddLabel(415, 67, 2420, "Monthly Score (Server Rank)"); AddLabel(Utility.CenteredTextOffset(510, monthlyScoreText), 87, WhiteTextHue, monthlyScoreText); AddLabel(415, 109, 2603, "Lifetime Score (Server Rank)"); AddLabel(Utility.CenteredTextOffset(510, lifetimeScoreText), 129, WhiteTextHue, lifetimeScoreText); AddButton(130, 141, 4029, 4031, 5, GumpButtonType.Reply, 0); AddLabel(165, 142, 63, "Spend Points"); int startX = 268; int startY = 57; #region Societies Images switch (m_SocietiesGroup) { case SocietiesGroupType.FishermansCircle: AddItem(startX + 34, startY + 19, 3520); AddItem(startX + 66, startY + 48, 3656); AddItem(startX + 35, startY + 36, 2476); AddItem(startX + 76, startY + 39, 2467); AddItem(startX + 45, startY + 35, 15113); break; case SocietiesGroupType.SmithingOrder: AddItem(startX + 36, startY + 29, 5073); AddItem(startX + 86, startY + 29, 5096); AddItem(startX + 50, startY + 39, 7035); AddItem(startX + 54, startY + 37, 5050); AddItem(startX + 47, startY + 33, 5181); break; case SocietiesGroupType.TradesmanUnion: AddItem(startX + 29, startY + 27, 4142); AddItem(startX + 37, startY + 23, 4150); AddItem(startX + 61, startY + 35, 2920); AddItem(startX + 49, startY + 25, 2921); AddItem(startX + 67, startY + 47, 4148); AddItem(startX + 48, startY + 31, 4189); AddItem(startX + 57, startY + 27, 2581); AddItem(startX + 36, startY + 20, 2503); AddItem(startX + 45, startY + 14, 4172); break; case SocietiesGroupType.ArtificersEnclave: AddItem(startX + 62, startY + 30, 2942, 2500); AddItem(startX + 37, startY + 16, 2943, 2500); AddItem(startX + 40, startY + 20, 4031); AddItem(startX + 65, startY + 19, 6237); AddItem(startX + 59, startY + 37, 3626); AddItem(startX + 45, startY + 13, 3643, 2415); AddItem(startX + 40, startY + 29, 5357); AddItem(startX + 44, startY + 31, 5357); AddItem(startX + 65, startY + 43, 3622); break; case SocietiesGroupType.SeafarersLeague: AddItem(startX + 70, startY + 40, 5370); AddItem(startX + 46, startY + 3, 709); break; case SocietiesGroupType.AdventurersLodge: AddItem(startX + 57, startY + 24, 4967); AddItem(startX + 49, startY + 35, 4970); AddItem(startX + 64, startY + 49, 2648); AddItem(startX + 34, startY + 38, 5356); AddItem(startX + 40, startY + 45, 3922); AddItem(startX + 1, startY + 30, 3898); AddItem(startX + 50, startY + 25, 5365); break; case SocietiesGroupType.ZoologicalFoundation: AddItem(startX + 50, startY + 40, 2476); AddItem(startX + 47, startY + 31, 3191); AddItem(startX + 51, startY + 29, 3191); AddItem(startX + 50, startY + 30, 3713); break; case SocietiesGroupType.ThievesGuild: AddItem(startX + 58, startY + 39, 5373); AddItem(startX + 48, startY + 33, 3589); break; case SocietiesGroupType.FarmersCooperative: AddItem(startX + 54, startY + 23, 18240); break; case SocietiesGroupType.MonsterHuntersSociety: AddItem(startX + 32, startY + 26, 7433); AddItem(startX + 34, startY + 38, 4655); AddItem(startX + 54, startY + 23, 7438); AddItem(startX + 27, startY + 40, 7782); AddItem(startX + 44, startY + 38, 3910); break; } #endregion AddLabel(165, 175, 149, "Job Description"); AddLabel(380, 175, 149, "Accepted"); AddLabel(520, 175, 149, "Completion"); startY = 200; int entrySpacing = 50; List <SocietyJob> m_SocietiesJobs = Societies.GetSocietyJobsByGroup(m_SocietiesGroup); for (int a = 0; a < m_SocietiesJobs.Count; a++) { SocietyJob societyJob = m_SocietiesJobs[a]; if (societyJob == null) { continue; } if (societyJob.Deleted) { continue; } if (!societyJob.m_Listed) { continue; } SocietyJobPlayerProgress jobPlayerProgress = Societies.GetSocietiesJobPlayerProgress(m_Player, societyJob); AddItem(5 + societyJob.m_IconOffsetX, -35 + startY + societyJob.m_IconOffsetY, societyJob.m_IconItemId, societyJob.m_IconHue); //Image AddLabel(120, startY, WhiteTextHue, societyJob.GetJobDescriptionText()); AddLabel(140, startY + 20, societiesGroupTextHue, societyJob.GetJobRewardText()); if (jobPlayerProgress != null) { AddButton(390, startY, 2154, 2151, 10 + a, GumpButtonType.Reply, 0); } else { AddButton(390, startY, 2151, 2154, 10 + a, GumpButtonType.Reply, 0); } string destinationText = societyJob.GetJobDestinationText(); AddLabel(Utility.CenteredTextOffset(555, destinationText), startY, 2550, destinationText); startY += entrySpacing; } //----- AddButton(35, 416, 4014, 4016, 2, GumpButtonType.Reply, 0); AddLabel(69, 416, WhiteTextHue, "Previous Society"); AddButton(516, 416, 4005, 4007, 3, GumpButtonType.Reply, 0); AddLabel(552, 416, WhiteTextHue, "Next Society"); AddButton(259, 415, 4008, 4010, 4, GumpButtonType.Reply, 0); AddLabel(296, 416, 149, "View Server Rankings"); break; #endregion #region Server Rankings case SocietiesGroupPageDisplayType.ServerRankings: #region Header Images AddImage(462, 60, 103); AddImage(322, 60, 103); AddImage(102, 60, 103); AddImage(205, 60, 103); AddImage(102, 48, 103); AddImage(233, 48, 103); AddImage(325, 48, 103); AddImage(462, 48, 103); AddImage(112, 58, 5104, 2052); AddImage(191, 58, 5104, 2052); AddImage(234, 58, 5104, 2052); AddImage(298, 58, 5104, 2052); AddImage(347, 58, 5104, 2052); AddImage(504, 58, 5104, 2052); AddImage(431, 58, 5104, 2052); #endregion monthlyRanks = Societies.GetSocietyGroupMonthlyRanks(m_SocietiesGroup); lifetimeRanks = Societies.GetSocietyGroupMonthlyRanks(m_SocietiesGroup); monthlyRank = monthlyRanks.Count; lifetimeRank = lifetimeRanks.Count; for (int a = 0; a < monthlyRanks.Count; a++) { if (monthlyRanks[a].Key == m_Player) { monthlyRank = a + 1; break; } } for (int a = 0; a < lifetimeRanks.Count; a++) { if (lifetimeRanks[a].Key == m_Player) { lifetimeRank = a + 1; break; } } monthlyRankText = monthlyRank.ToString() + Utility.DetermineNumberSuffix(monthlyRank); lifetimeRankText = lifetimeRank.ToString() + Utility.DetermineNumberSuffix(lifetimeRank); AddImage(203, 40, 1141); AddLabel(Utility.CenteredTextOffset(350, societiesGroupName), 42, societiesGroupTextHue, societiesGroupName); startX = 268; startY = 57; #region Societies Images switch (m_SocietiesGroup) { case SocietiesGroupType.FishermansCircle: AddItem(startX + 34, startY + 19, 3520); AddItem(startX + 66, startY + 48, 3656); AddItem(startX + 35, startY + 36, 2476); AddItem(startX + 76, startY + 39, 2467); AddItem(startX + 45, startY + 35, 15113); break; case SocietiesGroupType.SmithingOrder: AddItem(startX + 36, startY + 29, 5073); AddItem(startX + 86, startY + 29, 5096); AddItem(startX + 50, startY + 39, 7035); AddItem(startX + 54, startY + 37, 5050); AddItem(startX + 47, startY + 33, 5181); break; case SocietiesGroupType.TradesmanUnion: AddItem(startX + 29, startY + 27, 4142); AddItem(startX + 37, startY + 23, 4150); AddItem(startX + 61, startY + 35, 2920); AddItem(startX + 49, startY + 25, 2921); AddItem(startX + 67, startY + 47, 4148); AddItem(startX + 48, startY + 31, 4189); AddItem(startX + 57, startY + 27, 2581); AddItem(startX + 36, startY + 20, 2503); AddItem(startX + 45, startY + 14, 4172); break; case SocietiesGroupType.ArtificersEnclave: AddItem(startX + 62, startY + 30, 2942, 2500); AddItem(startX + 37, startY + 16, 2943, 2500); AddItem(startX + 40, startY + 20, 4031); AddItem(startX + 65, startY + 19, 6237); AddItem(startX + 59, startY + 37, 3626); AddItem(startX + 45, startY + 13, 3643, 2415); AddItem(startX + 40, startY + 29, 5357); AddItem(startX + 44, startY + 31, 5357); AddItem(startX + 65, startY + 43, 3622); break; case SocietiesGroupType.SeafarersLeague: AddItem(startX + 70, startY + 40, 5370); AddItem(startX + 46, startY + 3, 709); break; case SocietiesGroupType.AdventurersLodge: AddItem(startX + 57, startY + 24, 4967); AddItem(startX + 49, startY + 35, 4970); AddItem(startX + 64, startY + 49, 2648); AddItem(startX + 34, startY + 38, 5356); AddItem(startX + 40, startY + 45, 3922); AddItem(startX + 1, startY + 30, 3898); AddItem(startX + 50, startY + 25, 5365); break; case SocietiesGroupType.ZoologicalFoundation: AddItem(startX + 50, startY + 40, 2476); AddItem(startX + 47, startY + 31, 3191); AddItem(startX + 51, startY + 29, 3191); AddItem(startX + 50, startY + 30, 3713); break; case SocietiesGroupType.ThievesGuild: AddItem(startX + 58, startY + 39, 5373); AddItem(startX + 48, startY + 33, 3589); break; case SocietiesGroupType.FarmersCooperative: AddItem(startX + 54, startY + 23, 18240); break; case SocietiesGroupType.MonsterHuntersSociety: AddItem(startX + 32, startY + 26, 7433); AddItem(startX + 34, startY + 38, 4655); AddItem(startX + 54, startY + 23, 7438); AddItem(startX + 27, startY + 40, 7782); AddItem(startX + 44, startY + 38, 3910); break; } #endregion string monthlyPointsRankText = monthlyPoints.ToString() + " (" + monthlyRankText + ")"; string lifetimePointsRankText = lifetimePoints.ToString() + " (" + lifetimeRankText + ")"; AddLabel(139, 82, 2420, "My Monthly Points (Rank)"); AddLabel(Utility.CenteredTextOffset(220, monthlyPointsRankText), 102, WhiteTextHue, monthlyPointsRankText); AddLabel(406, 82, 2603, "My Lifetime Points (Rank)"); AddLabel(Utility.CenteredTextOffset(495, lifetimePointsRankText), 102, WhiteTextHue, lifetimePointsRankText); AddLabel(67, 174, 2420, "Server Monthly Points Leader"); AddLabel(391, 175, 2603, "Server Lifetime Points Leader"); int labelTextHue = WhiteTextHue; //Monthly Rankings startY = 200; int monthlyCount = monthlyRanks.Count; if (monthlyCount > 10) { monthlyCount = 10; } for (int a = 0; a < monthlyCount; a++) { KeyValuePair <PlayerMobile, int> playerMonthlyRank = monthlyRanks[a]; if (playerMonthlyRank.Key != null) { if (playerMonthlyRank.Key == m_Player) { labelTextHue = 63; } AddLabel(46, 200, labelTextHue, (a + 1).ToString() + "."); AddLabel(110, startY, labelTextHue, playerMonthlyRank.Key.RawName); AddLabel(235, startY, labelTextHue, playerMonthlyRank.Value.ToString() + " Points"); } else { AddLabel(46, 200, labelTextHue, (a + 1).ToString() + "."); AddLabel(110, startY, labelTextHue, "-"); } startY += 20; } //Lifetime Rankings startY = 200; int lifetimeCount = lifetimeRanks.Count; if (lifetimeCount > 10) { lifetimeCount = 10; } for (int a = 0; a < monthlyCount; a++) { KeyValuePair <PlayerMobile, int> playerLifetimeRank = lifetimeRanks[a]; if (playerLifetimeRank.Key != null) { if (playerLifetimeRank.Key == m_Player) { labelTextHue = 63; } AddLabel(368, 200, labelTextHue, (a + 1).ToString() + "."); AddLabel(432, startY, labelTextHue, playerLifetimeRank.Key.RawName); AddLabel(557, startY, labelTextHue, playerLifetimeRank.Value.ToString() + " Points"); } else { AddLabel(368, 200, labelTextHue, (a + 1).ToString() + "."); AddLabel(432, startY, labelTextHue, "-"); } startY += 20; } AddButton(35, 416, 4014, 4016, 2, GumpButtonType.Reply, 0); AddLabel(69, 416, WhiteTextHue, "Previous Society"); AddButton(516, 416, 4005, 4007, 3, GumpButtonType.Reply, 0); AddLabel(552, 416, WhiteTextHue, "Next Society"); AddButton(259, 415, 4008, 4010, 4, GumpButtonType.Reply, 0); AddLabel(296, 416, 149, "View Job Contracts"); break; #endregion #region Spend Points case SocietiesGroupPageDisplayType.SpendPoints: #region Header Images AddImage(462, 60, 103); AddImage(322, 60, 103); AddImage(102, 60, 103); AddImage(205, 60, 103); AddImage(102, 48, 103); AddImage(233, 48, 103); AddImage(325, 48, 103); AddImage(462, 48, 103); AddImage(112, 58, 5104, 2052); AddImage(191, 58, 5104, 2052); AddImage(234, 58, 5104, 2052); AddImage(298, 58, 5104, 2052); AddImage(347, 58, 5104, 2052); AddImage(504, 58, 5104, 2052); AddImage(431, 58, 5104, 2052); #endregion AddImage(203, 40, 1141); AddLabel(Utility.CenteredTextOffset(350, societiesGroupName), 42, societiesGroupTextHue, societiesGroupName); startX = 268; startY = 57; #region Societies Images switch (m_SocietiesGroup) { case SocietiesGroupType.FishermansCircle: AddItem(startX + 34, startY + 19, 3520); AddItem(startX + 66, startY + 48, 3656); AddItem(startX + 35, startY + 36, 2476); AddItem(startX + 76, startY + 39, 2467); AddItem(startX + 45, startY + 35, 15113); break; case SocietiesGroupType.SmithingOrder: AddItem(startX + 36, startY + 29, 5073); AddItem(startX + 86, startY + 29, 5096); AddItem(startX + 50, startY + 39, 7035); AddItem(startX + 54, startY + 37, 5050); AddItem(startX + 47, startY + 33, 5181); break; case SocietiesGroupType.TradesmanUnion: AddItem(startX + 29, startY + 27, 4142); AddItem(startX + 37, startY + 23, 4150); AddItem(startX + 61, startY + 35, 2920); AddItem(startX + 49, startY + 25, 2921); AddItem(startX + 67, startY + 47, 4148); AddItem(startX + 48, startY + 31, 4189); AddItem(startX + 57, startY + 27, 2581); AddItem(startX + 36, startY + 20, 2503); AddItem(startX + 45, startY + 14, 4172); break; case SocietiesGroupType.ArtificersEnclave: AddItem(startX + 62, startY + 30, 2942, 2500); AddItem(startX + 37, startY + 16, 2943, 2500); AddItem(startX + 40, startY + 20, 4031); AddItem(startX + 65, startY + 19, 6237); AddItem(startX + 59, startY + 37, 3626); AddItem(startX + 45, startY + 13, 3643, 2415); AddItem(startX + 40, startY + 29, 5357); AddItem(startX + 44, startY + 31, 5357); AddItem(startX + 65, startY + 43, 3622); break; case SocietiesGroupType.SeafarersLeague: AddItem(startX + 70, startY + 40, 5370); AddItem(startX + 46, startY + 3, 709); break; case SocietiesGroupType.AdventurersLodge: AddItem(startX + 57, startY + 24, 4967); AddItem(startX + 49, startY + 35, 4970); AddItem(startX + 64, startY + 49, 2648); AddItem(startX + 34, startY + 38, 5356); AddItem(startX + 40, startY + 45, 3922); AddItem(startX + 1, startY + 30, 3898); AddItem(startX + 50, startY + 25, 5365); break; case SocietiesGroupType.ZoologicalFoundation: AddItem(startX + 50, startY + 40, 2476); AddItem(startX + 47, startY + 31, 3191); AddItem(startX + 51, startY + 29, 3191); AddItem(startX + 50, startY + 30, 3713); break; case SocietiesGroupType.ThievesGuild: AddItem(startX + 58, startY + 39, 5373); AddItem(startX + 48, startY + 33, 3589); break; case SocietiesGroupType.FarmersCooperative: AddItem(startX + 54, startY + 23, 18240); break; case SocietiesGroupType.MonsterHuntersSociety: AddItem(startX + 32, startY + 26, 7433); AddItem(startX + 34, startY + 38, 4655); AddItem(startX + 54, startY + 23, 7438); AddItem(startX + 27, startY + 40, 7782); AddItem(startX + 44, startY + 38, 3910); break; } #endregion AddLabel(143, 93, societiesGroupTextHue, availablePoints + " Points Available"); AddLabel(451, 67, 2420, "Total Points Spent"); AddLabel(Utility.CenteredTextOffset(510, pointsSpent.ToString()), 87, WhiteTextHue, pointsSpent.ToString()); AddLabel(449, 109, 2603, "Total Points Earned"); AddLabel(Utility.CenteredTextOffset(510, lifetimePoints.ToString()), 129, WhiteTextHue, lifetimePoints.ToString()); List <SocietyRewardItem> itemList = SocietiesRewards.SocietyRewardList[m_SocietiesGroup]; int totalItems = itemList.Count; int totalItemPages = (int)(Math.Ceiling((double)totalItems / (double)RewardItemsPerPage)); if (m_RewardPage >= totalItemPages) { m_RewardPage = 0; } if (m_RewardPage < 0) { m_RewardPage = 0; } int itemStartIndex = m_RewardPage * RewardItemsPerPage; int itemEndIndex = (m_RewardPage * RewardItemsPerPage) + (RewardItemsPerPage - 1); if (itemEndIndex >= totalItems) { itemEndIndex = totalItems - 1; } int itemCount = itemEndIndex - itemStartIndex; for (int a = 0; a < itemCount + 1; a++) { if (totalItems == 0) { continue; } switch (a) { case 0: startX = 108; startY = 198; break; case 1: startX = 458; startY = 198; break; case 2: startX = 108; startY = 312; break; case 3: startX = 458; startY = 312; break; } int itemIndex = itemStartIndex + a; if (itemIndex >= itemList.Count) { continue; } SocietyRewardItem item = itemList[itemIndex]; if (item == null) { continue; } //Item AddItem(startX - 113 + item.ItemIconOffsetX, startY - 18 + item.ItemIconOffsetY, item.ItemIconItemId, item.ItemIconHue); AddLabel(startX, startY, WhiteTextHue, item.ItemName); AddLabel(startX, startY + 20, 53, "Cost"); AddLabel(startX + 40, startY + 20, societiesGroupTextHue, item.ItemCost.ToString() + " Points"); AddLabel(startX, startY + 40, 2599, "Info"); AddButton(startX + 33, startY + 43, 1209, 1210, 20 + a, GumpButtonType.Reply, 0); AddLabel(startX + 62, startY + 40, 63, "Purchase"); AddButton(startX + 124, startY + 38, 2151, 2154, 10 + a, GumpButtonType.Reply, 0); } bool previousPagesExist = false; bool morePagesExist = false; if (m_RewardPage > 0) { previousPagesExist = true; } if (m_RewardPage < totalItemPages - 1) { morePagesExist = true; } if (previousPagesExist) { AddButton(327, 254, 9900, 9900, 5, GumpButtonType.Reply, 0); } if (previousPagesExist || morePagesExist) { AddLabel(303, 278, WhiteTextHue, "More Items"); } if (morePagesExist) { AddButton(326, 302, 9906, 9906, 6, GumpButtonType.Reply, 0); } AddButton(35, 416, 4014, 4016, 2, GumpButtonType.Reply, 0); AddLabel(69, 416, WhiteTextHue, "Previous Society"); AddButton(516, 416, 4005, 4007, 3, GumpButtonType.Reply, 0); AddLabel(552, 416, WhiteTextHue, "Next Society"); AddButton(259, 415, 4008, 4010, 4, GumpButtonType.Reply, 0); AddLabel(296, 416, 149, "View Job Contracts"); break; #endregion } }
public SocitiesJobContractGump(PlayerMobile player, SocietiesJobContract societiesJobContract) : base(10, 10) { m_Player = player; m_SocietiesJobContract = societiesJobContract; if (m_Player == null) { return; } if (m_SocietiesJobContract == null) { m_Player.SendMessage("That job contract is no longer accessible"); return; } if (m_SocietiesJobContract.Deleted) { m_Player.SendMessage("That job contract is no longer accessible"); return; } if (m_SocietiesJobContract.m_Job == null) { m_Player.SendMessage("That job is no longer available"); return; } if (m_SocietiesJobContract.m_Job.Deleted) { m_Player.SendMessage("That job is no longer available"); return; } SocietyJob societyJob = m_SocietiesJobContract.m_Job; SocietyJobPlayerProgress jobPlayerProgress = Societies.GetSocietiesJobPlayerProgress(m_Player, societyJob); double progress = 0; double turnedInAmount = 0; if (jobPlayerProgress != null) { progress = jobPlayerProgress.m_ProgressAmount; turnedInAmount = jobPlayerProgress.m_TurnedInAmount; } bool readyForTurnIn = false; if (progress >= societyJob.m_TargetNumber) { readyForTurnIn = true; } AddImage(0, 0, 1249); int WhiteTextHue = 2499; string societiesGroupName = Societies.GetSocietyGroupName(societyJob.m_SocietiesGroupType); int societiesGroupTextHue = Societies.GetSocietyGroupTextHue(societyJob.m_SocietiesGroupType); string titleText = "Job Contract From " + societiesGroupName; string ownerName = "-"; if (m_SocietiesJobContract.m_Player != null) { ownerName = m_SocietiesJobContract.m_Player.RawName; } string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, societyJob.m_Expiration, true, true, true, true, false); string jobDescriptionText = societyJob.GetJobDescriptionText(); string jobProgressText = "Progress: " + progress + " / " + societyJob.m_TargetNumber.ToString(); string jobTurnInText = "Turned In: " + turnedInAmount + " / " + societyJob.m_TurnInRequirementAmount.ToString(); string destinationText = societyJob.GetJobDestinationText(); AddLabel(Utility.CenteredTextOffset(220, titleText), 37, societiesGroupTextHue, titleText); //Title int startX = 115; int startY = 50; #region Society Images switch (societyJob.m_SocietiesGroupType) { case SocietiesGroupType.FishermansCircle: AddItem(startX + 34, startY + 19, 3520); AddItem(startX + 66, startY + 48, 3656); AddItem(startX + 35, startY + 36, 2476); AddItem(startX + 76, startY + 39, 2467); AddItem(startX + 45, startY + 35, 15113); break; case SocietiesGroupType.SmithingOrder: AddItem(startX + 36, startY + 29, 5073); AddItem(startX + 86, startY + 29, 5096); AddItem(startX + 50, startY + 39, 7035); AddItem(startX + 54, startY + 37, 5050); AddItem(startX + 47, startY + 33, 5181); break; case SocietiesGroupType.TradesmanUnion: AddItem(startX + 29, startY + 27, 4142); AddItem(startX + 37, startY + 23, 4150); AddItem(startX + 61, startY + 35, 2920); AddItem(startX + 49, startY + 25, 2921); AddItem(startX + 67, startY + 47, 4148); AddItem(startX + 48, startY + 31, 4189); AddItem(startX + 57, startY + 27, 2581); AddItem(startX + 36, startY + 20, 2503); AddItem(startX + 45, startY + 14, 4172); break; case SocietiesGroupType.ArtificersEnclave: AddItem(startX + 62, startY + 30, 2942, 2500); AddItem(startX + 37, startY + 16, 2943, 2500); AddItem(startX + 40, startY + 20, 4031); AddItem(startX + 65, startY + 19, 6237); AddItem(startX + 59, startY + 37, 3626); AddItem(startX + 45, startY + 13, 3643, 2415); AddItem(startX + 40, startY + 29, 5357); AddItem(startX + 44, startY + 31, 5357); AddItem(startX + 65, startY + 43, 3622); break; case SocietiesGroupType.SeafarersLeague: AddItem(startX + 70, startY + 40, 5370); AddItem(startX + 46, startY + 3, 709); break; case SocietiesGroupType.AdventurersLodge: AddItem(startX + 57, startY + 24, 4967); AddItem(startX + 49, startY + 35, 4970); AddItem(startX + 64, startY + 49, 2648); AddItem(startX + 34, startY + 38, 5356); AddItem(startX + 40, startY + 45, 3922); AddItem(startX + 1, startY + 30, 3898); AddItem(startX + 50, startY + 25, 5365); break; case SocietiesGroupType.ZoologicalFoundation: AddItem(startX + 50, startY + 40, 2476); AddItem(startX + 47, startY + 31, 3191); AddItem(startX + 51, startY + 29, 3191); AddItem(startX + 50, startY + 30, 3713); break; case SocietiesGroupType.ThievesGuild: AddItem(startX + 58, startY + 39, 5373); AddItem(startX + 48, startY + 33, 3589); break; case SocietiesGroupType.FarmersCooperative: AddItem(startX + 54, startY + 23, 18240); break; case SocietiesGroupType.MonsterHuntersSociety: AddItem(startX + 32, startY + 26, 7433); AddItem(startX + 34, startY + 38, 4655); AddItem(startX + 54, startY + 23, 7438); AddItem(startX + 27, startY + 40, 7782); AddItem(startX + 44, startY + 38, 3910); break; } #endregion AddLabel(8, 14, 149, "Guide"); AddButton(11, 30, 2094, 2095, 1, GumpButtonType.Reply, 0); AddLabel(58, 80, 2599, "Accepted By"); AddLabel(Utility.CenteredTextOffset(95, ownerName), 100, WhiteTextHue, ownerName); AddLabel(250, 80, 2603, "Job Expires In"); AddLabel(Utility.CenteredTextOffset(295, timeRemaining), 100, WhiteTextHue, timeRemaining); AddLabel(142, 140, 149, "Job Description"); AddItem(-2 + societyJob.m_IconOffsetX, 125 + societyJob.m_IconOffsetY, societyJob.m_IconItemId, societyJob.Hue); //Image startY = 160; int rowSpacing = 20; AddLabel(105, startY, WhiteTextHue, jobDescriptionText); startY += rowSpacing; if (readyForTurnIn) { AddLabel(105, startY, 63, jobProgressText); } else { AddLabel(105, startY, 2114, jobProgressText); } startY += rowSpacing; if (societyJob.m_TurnInRequirementAmount > 0) { AddLabel(105, startY, 2301, jobTurnInText); startY += rowSpacing; } AddLabel(105, startY, societiesGroupTextHue, societyJob.GetJobRewardText()); AddLabel(69, 245, 149, "Turn In"); AddButton(77, 265, 2151, 2154, 2, GumpButtonType.Reply, 0); AddLabel(170, 245, 149, "Completion Destination"); AddLabel(Utility.CenteredTextOffset(245, destinationText), 265, 2550, destinationText); }