public static int GetSocietyGroupTextHue(SocietiesGroupType societyGroupType) { switch (societyGroupType) { case SocietiesGroupType.AdventurersLodge: return(152); break; case SocietiesGroupType.ArtificersEnclave: return(2606); break; case SocietiesGroupType.FarmersCooperative: return(2599); break; case SocietiesGroupType.FishermansCircle: return(2590); break; case SocietiesGroupType.MonsterHuntersSociety: return(2116); break; case SocietiesGroupType.SeafarersLeague: return(2603); break; case SocietiesGroupType.SmithingOrder: return(2401); break; case SocietiesGroupType.ThievesGuild: return(2036); break; case SocietiesGroupType.TradesmanUnion: return(2417); break; case SocietiesGroupType.ZoologicalFoundation: return(63); break; } return(2499); }
public static string GetSocietyGroupName(SocietiesGroupType societyGroupType) { switch (societyGroupType) { case SocietiesGroupType.AdventurersLodge: return("Adventurer's Lodge"); break; case SocietiesGroupType.ArtificersEnclave: return("Artificer's Enclave"); break; case SocietiesGroupType.FarmersCooperative: return("Farmer's Cooperative"); break; case SocietiesGroupType.FishermansCircle: return("Fisherman's Circle"); break; case SocietiesGroupType.MonsterHuntersSociety: return("Monster Hunter's Society"); break; case SocietiesGroupType.SeafarersLeague: return("Seafarer's League"); break; case SocietiesGroupType.SmithingOrder: return("Smithing Order"); break; case SocietiesGroupType.ThievesGuild: return("Thieves Guild"); break; case SocietiesGroupType.TradesmanUnion: return("Tradesman Union"); break; case SocietiesGroupType.ZoologicalFoundation: return("Zoological Foundation"); break; } return(""); }
public void CreateSocietyData() { int societyTypesCount = Enum.GetNames(typeof(SocietiesGroupType)).Length; for (int a = 0; a < societyTypesCount; a++) { SocietiesGroupType societyGroupType = (SocietiesGroupType)a; SocietyGroupPlayerData societyPlayerData = new SocietyGroupPlayerData(societyGroupType); m_SocietyPlayerData.Add(societyPlayerData); } }
public static List <SocietyJob> GetSocietyJobsByGroup(SocietiesGroupType societyGroupType) { List <SocietyJob> m_SocietiesJobs = new List <SocietyJob>(); for (int a = 0; a < m_SocietyJobs.Count; a++) { if (m_SocietyJobs[a].m_SocietiesGroupType == societyGroupType) { m_SocietiesJobs.Add(m_SocietyJobs[a]); } } return(m_SocietiesJobs); }
public SocietyGroupPlayerData GetSocietyGroupPlayerData(SocietiesGroupType societyGroupType) { foreach (SocietyGroupPlayerData societyPlayerData in m_SocietyPlayerData) { if (societyPlayerData == null) { continue; } if (societyPlayerData.m_SocietyGroupType == societyGroupType) { return(societyPlayerData); } } return(null); }
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 override void OnResponse(NetState sender, RelayInfo info) { if (m_Player == null) { return; } bool closeGump = true; Societies.CheckCreateSocietiesPlayerSettings(m_Player); SocietyGroupPlayerData societyGroupPlayerData = m_Player.m_SocietiesPlayerSettings.GetSocietyGroupPlayerData(m_SocietiesGroup); if (societyGroupPlayerData == null) { return; } int availablePoints = societyGroupPlayerData.m_PointsAvailable; switch (m_SocietiesGroupPageDisplay) { #region Jobs case SocietiesGroupPageDisplayType.Jobs: switch (info.ButtonID) { //Guide case 1: closeGump = false; break; //Previous Society case 2: int societiesIndex = (int)m_SocietiesGroup; societiesIndex--; if (societiesIndex < 0) { societiesIndex = Enum.GetNames(typeof(SocietiesGroupType)).Length - 1; } m_SocietiesGroup = (SocietiesGroupType)societiesIndex; m_RewardPage = 0; m_Player.SendSound(ChangePageSound); closeGump = false; break; //Next Society case 3: societiesIndex = (int)m_SocietiesGroup; societiesIndex++; if (societiesIndex > Enum.GetNames(typeof(SocietiesGroupType)).Length - 1) { societiesIndex = 0; } m_SocietiesGroup = (SocietiesGroupType)societiesIndex; m_RewardPage = 0; m_Player.SendSound(ChangePageSound); closeGump = false; break; //View Server Rankings case 4: m_SocietiesGroupPageDisplay = SocietiesGroupPageDisplayType.ServerRankings; m_Player.SendSound(OpenGumpSound); closeGump = false; break; //Spend Points case 5: m_SocietiesGroupPageDisplay = SocietiesGroupPageDisplayType.SpendPoints; m_Player.SendSound(OpenGumpSound); closeGump = false; break; } if (info.ButtonID >= 10) { List <SocietyJob> m_SocietiesJobs = Societies.GetSocietyJobsByGroup(m_SocietiesGroup); int jobIndex = info.ButtonID - 10; if (jobIndex < m_SocietiesJobs.Count) { SocietyJob societyJob = m_SocietiesJobs[jobIndex]; if (societyJob != null) { if (!societyJob.Deleted) { societyJob.PlayerAccept(m_Player); } } } closeGump = false; } break; #endregion #region Server Rankings case SocietiesGroupPageDisplayType.ServerRankings: switch (info.ButtonID) { //Guide case 1: closeGump = false; break; //Previous Society case 2: int societiesIndex = (int)m_SocietiesGroup; societiesIndex--; if (societiesIndex < 0) { societiesIndex = Enum.GetNames(typeof(SocietiesGroupType)).Length - 1; } m_SocietiesGroup = (SocietiesGroupType)societiesIndex; m_RewardPage = 0; m_Player.SendSound(ChangePageSound); closeGump = false; break; //Next Society case 3: societiesIndex = (int)m_SocietiesGroup; societiesIndex++; if (societiesIndex > Enum.GetNames(typeof(SocietiesGroupType)).Length - 1) { societiesIndex = 0; } m_SocietiesGroup = (SocietiesGroupType)societiesIndex; m_RewardPage = 0; m_Player.SendSound(ChangePageSound); closeGump = false; break; //View Job Contracts case 4: m_SocietiesGroupPageDisplay = SocietiesGroupPageDisplayType.Jobs; m_Player.SendSound(OpenGumpSound); closeGump = false; break; } break; #endregion #region Spend Points case SocietiesGroupPageDisplayType.SpendPoints: 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; } switch (info.ButtonID) { //Guide case 1: closeGump = false; break; //Previous Society case 2: int societiesIndex = (int)m_SocietiesGroup; societiesIndex--; if (societiesIndex < 0) { societiesIndex = Enum.GetNames(typeof(SocietiesGroupType)).Length - 1; } m_SocietiesGroup = (SocietiesGroupType)societiesIndex; m_RewardPage = 0; m_Player.SendSound(ChangePageSound); closeGump = false; break; //Next Society case 3: societiesIndex = (int)m_SocietiesGroup; societiesIndex++; if (societiesIndex > Enum.GetNames(typeof(SocietiesGroupType)).Length - 1) { societiesIndex = 0; } m_SocietiesGroup = (SocietiesGroupType)societiesIndex; m_RewardPage = 0; m_Player.SendSound(ChangePageSound); closeGump = false; break; //View Job Contracts case 4: m_SocietiesGroupPageDisplay = SocietiesGroupPageDisplayType.Jobs; m_Player.SendSound(ChangePageSound); closeGump = false; break; //Previous Rewards Page case 5: m_RewardPage--; m_Player.SendSound(SelectionSound); closeGump = false; break; //Next Rewards Page case 6: m_RewardPage++; m_Player.SendSound(SelectionSound); closeGump = false; break; } //Purchase Item if (info.ButtonID >= 10 && info.ButtonID < 20) { int itemSelectionIndex = info.ButtonID - 10; int itemSelected = (m_RewardPage * RewardItemsPerPage) + itemSelectionIndex; if (itemSelected >= totalItems) { itemSelected = 0; } SocietyRewardItem item = itemList[itemSelected]; if (item == null) { return; } bool purchaseAllowed = true; int pointsCost = 0; Item rewardItem = (Item)Activator.CreateInstance(item.ItemType); if (rewardItem == null) { } else if (!purchaseAllowed && m_Player.AccessLevel == AccessLevel.Player) { rewardItem.Delete(); m_Player.SendMessage("Reward purchases are not allowed in this area."); } else if (item.ItemCost > availablePoints && m_Player.AccessLevel == AccessLevel.Player) { rewardItem.Delete(); m_Player.SendMessage("You do not have enough points available to spend in this society to purchase that item."); } else if (m_Player.Backpack.TotalItems + rewardItem.TotalItems > m_Player.Backpack.MaxItems && m_Player.AccessLevel == AccessLevel.Player) { rewardItem.Delete(); m_Player.SendMessage("Your backpack contains too many items to purchase this item. Please remove some items and try again."); } else if (m_Player.Backpack.TotalWeight + rewardItem.TotalWeight > m_Player.MaxWeight && m_Player.AccessLevel == AccessLevel.Player) { rewardItem.Delete(); m_Player.SendMessage("Your backpack is too heavy to purchase this item. Please remove some items and try again."); } else { if (m_Player.AccessLevel == AccessLevel.Player) { societyGroupPlayerData.m_PointsAvailable -= pointsCost; societyGroupPlayerData.m_PointsSpent += pointsCost; m_Player.SendMessage("You purchase the item."); } else { m_Player.SendMessage("You use your godly powers to purchase the item."); } m_Player.SendSound(PurchaseSound); rewardItem.ItemGroup = ItemGroupType.PurchasedReward; m_Player.Backpack.DropItem(rewardItem); } closeGump = false; } //Item Info if (info.ButtonID >= 20 && info.ButtonID < 30) { int itemSelectionIndex = info.ButtonID - 20; int itemSelected = (m_RewardPage * RewardItemsPerPage) + itemSelectionIndex; if (itemSelected >= totalItems) { itemSelected = 0; } SocietyRewardItem item = itemList[itemSelected]; if (item == null) { return; } string description = ""; if (item.ItemDescription != null) { for (int a = 0; a < item.ItemDescription.Count; a++) { description += item.ItemDescription[a]; if (a < item.ItemDescription.Count - 1) { description += " "; } } } m_Player.SendMessage(description); closeGump = false; } break; #endregion } if (!closeGump) { m_Player.CloseGump(typeof(SocietiesJobBoardGump)); m_Player.SendGump(new SocietiesJobBoardGump(m_Player, m_SocietiesGroup, m_SocietiesGroupPageDisplay, m_RewardPage)); } 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 SocietyGroupPlayerData(SocietiesGroupType societyGroupType) { m_SocietyGroupType = societyGroupType; }
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 List <KeyValuePair <PlayerMobile, int> > GetSocietyGroupLifetimeRanks(SocietiesGroupType societyGroupType) { Dictionary <PlayerMobile, int> dictPlayers = new Dictionary <PlayerMobile, int>(); foreach (Mobile mobile in World.Mobiles.Values) { if (mobile == null) { continue; } if (mobile.Deleted) { continue; } if (!mobile.Player) { continue; } PlayerMobile pm_Target = mobile as PlayerMobile; Societies.CheckCreateSocietiesPlayerSettings(pm_Target); SocietyGroupPlayerData societyGroupPlayerData = pm_Target.m_SocietiesPlayerSettings.GetSocietyGroupPlayerData(societyGroupType); if (societyGroupPlayerData == null) { continue; } if (societyGroupPlayerData.m_MontlyPoints > 0) { dictPlayers.Add(pm_Target, societyGroupPlayerData.m_LifetimePoints); } } List <KeyValuePair <PlayerMobile, int> > m_Results = new List <KeyValuePair <PlayerMobile, int> >(); foreach (KeyValuePair <PlayerMobile, int> pair in dictPlayers.OrderByDescending(key => key.Value)) { PlayerMobile pm_Target = pair.Key; int points = pair.Value; m_Results.Add(pair); } return(m_Results); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); //Version 0 if (version >= 0) { m_Listed = reader.ReadBool(); m_Expiration = reader.ReadDateTime(); m_PointValue = reader.ReadInt(); m_SocietiesGroupType = (SocietiesGroupType)reader.ReadInt(); m_JobType = (JobType)reader.ReadInt(); m_PrimaryTypeName = reader.ReadString(); string primaryType = reader.ReadString(); if (primaryType == "null") { m_PrimaryType = null; } else { m_PrimaryType = Type.GetType(primaryType); } m_SecondaryTypeName = reader.ReadString(); string secondaryType = reader.ReadString(); if (secondaryType == "null") { m_SecondaryType = null; } else { m_SecondaryType = Type.GetType(secondaryType); } m_TargetNumber = reader.ReadDouble(); m_TurnInRequirementAmount = reader.ReadDouble(); m_CraftResourceRequired = (CraftResource)reader.ReadInt(); m_PrimaryJobModifier = (JobModifierType)reader.ReadInt(); m_SecondaryJobModifier = (JobModifierType)reader.ReadInt(); m_IconItemId = reader.ReadInt(); m_IconHue = reader.ReadInt(); m_IconOffsetX = reader.ReadInt(); m_IconOffsetY = reader.ReadInt(); string destionationMobile = reader.ReadString(); if (destionationMobile == "null") { m_DestinationMobile = null; } else { m_DestinationMobile = Type.GetType(destionationMobile); } m_DestinationMobileName = reader.ReadString(); m_DestinationTown = reader.ReadItem() as Town; int playersCompletedCount = reader.ReadInt(); for (int a = 0; a < playersCompletedCount; a++) { m_PlayersCompleted.Add(reader.ReadMobile() as PlayerMobile); } } //----- Societies.m_SocietyJobs.Add(this); }