public override void OnDoubleClick(Mobile from) { base.OnDoubleClick(from); PlayerMobile player = from as PlayerMobile; if (player == null) { return; } if (player.Backpack == null) { return; } if (!IsChildOf(player.Backpack)) { player.SendMessage("That must be in your pack in order to use it."); return; } EnhancementsPersistance.CheckAndCreateEnhancementsAccountEntry(player); Enhancements.EmoteEntry entry = Enhancements.GetEmoteEntry(player, m_EmoteType); Enhancements.EmoteDetail detail = Enhancements.GetEmoteDetail(m_EmoteType); if (entry == null) { entry = new Enhancements.EmoteEntry(m_EmoteType, true); player.m_EnhancementsAccountEntry.m_Emotes.Add(entry); player.SendMessage("You unlock the emote: [" + detail.m_EmoteName + "] on your account."); player.PlaySound(0x5C9); Delete(); } else { player.SendMessage("You have already unlocked this emote for your account."); } }
public static EmoteEntry GetEmoteEntry(PlayerMobile player, EmoteType emoteType) { EmoteEntry entry = null; if (player == null) { return(entry); } EnhancementsPersistance.CheckAndCreateEnhancementsAccountEntry(player); foreach (EmoteEntry playerEntry in player.m_EnhancementsAccountEntry.m_Emotes) { if (playerEntry.m_Emote == emoteType) { return(playerEntry); } } return(entry); }
public static SpellHueEntry GetSpellHueEntry(PlayerMobile player, SpellType spellType) { SpellHueEntry entry = null; if (player == null) { return(entry); } EnhancementsPersistance.CheckAndCreateEnhancementsAccountEntry(player); foreach (SpellHueEntry playerEntry in player.m_EnhancementsAccountEntry.m_SpellHues) { if (playerEntry.m_SpellType == spellType) { return(playerEntry); } } return(entry); }
public static CustomizationEntry GetCustomizationEntry(PlayerMobile player, CustomizationType customization) { CustomizationEntry entry = null; if (player == null) { return(entry); } EnhancementsPersistance.CheckAndCreateEnhancementsAccountEntry(player); foreach (CustomizationEntry playerEntry in player.m_EnhancementsAccountEntry.m_Customizations) { if (playerEntry.m_Customization == customization) { return(playerEntry); } } return(entry); }
public static int GetMobileSpellHue(Mobile mobile, SpellType spellType) { int hue = 0; BaseCreature bc_Creature = mobile as BaseCreature; if (bc_Creature != null) { return(bc_Creature.SpellHue); } PlayerMobile player = mobile as PlayerMobile; if (player == null) { return(hue); } EnhancementsPersistance.CheckAndCreateEnhancementsAccountEntry(player); foreach (Enhancements.SpellHueEntry entry in player.m_EnhancementsAccountEntry.m_SpellHues) { if (entry == null) { continue; } if (entry.m_SpellType == spellType) { Enhancements.SpellHueTypeDetail hueTypeDetail = Enhancements.GetSpellHueTypeDetail(entry.m_SelectedHue); return(hueTypeDetail.m_SpellHue); } } return(hue); }
public EnhancementsGump(PlayerMobile player, EnhancementsGumpObject enhancementsGumpObject) : base(10, 10) { m_Player = player; m_EnhancementsGumpObject = enhancementsGumpObject; if (m_Player == null) { return; } if (m_EnhancementsGumpObject == null) { return; } EnhancementsPersistance.CheckAndCreateEnhancementsAccountEntry(m_Player); List <Enhancements.CustomizationEntry> m_Customizations = m_Player.m_EnhancementsAccountEntry.m_Customizations; List <Enhancements.SpellHueEntry> m_SpellHues = m_Player.m_EnhancementsAccountEntry.m_SpellHues; List <Enhancements.EmoteEntry> m_Emotes = m_Player.m_EnhancementsAccountEntry.m_Emotes; #region Background AddImage(148, 110, 103); AddImage(149, 153, 103); AddImage(149, 239, 103); AddImage(149, 329, 103); AddImage(151, 415, 103, 2401); AddImage(14, 415, 103, 2401); AddImage(14, 238, 103, 2401); AddImage(148, 13, 103, 2401); AddImage(13, 152, 103, 2401); AddImage(14, 12, 103, 2401); AddImage(14, 109, 103, 2401); AddImage(23, 112, 3604, 2052); AddImage(149, 112, 3604, 2052); AddImage(23, 23, 3604, 2052); AddImage(149, 23, 3604, 2052); AddImage(14, 328, 103, 2401); AddImage(23, 199, 3604, 2052); AddImage(149, 199, 3604, 2052); AddImage(23, 291, 3604, 2052); AddImage(149, 291, 3604, 2052); AddImage(23, 377, 3604, 2052); AddImage(149, 377, 3604, 2052); AddImage(280, 110, 103); AddImage(281, 153, 103); AddImage(281, 239, 103); AddImage(281, 329, 103); AddImage(282, 415, 103, 2401); AddImage(280, 13, 103, 2401); AddImage(412, 110, 103, 2401); AddImage(413, 153, 103, 2401); AddImage(413, 239, 103, 2401); AddImage(413, 329, 103, 2401); AddImage(414, 415, 103, 2401); AddImage(412, 13, 103, 2401); AddImage(273, 112, 3604, 2052); AddImage(273, 23, 3604, 2052); AddImage(273, 199, 3604, 2052); AddImage(273, 291, 3604, 2052); AddImage(273, 376, 3604, 2052); AddImage(381, 112, 3604, 2052); AddImage(381, 23, 3604, 2052); AddImage(381, 199, 3604, 2052); AddImage(381, 291, 3604, 2052); AddImage(381, 376, 3604, 2052); AddImage(415, 112, 3604, 2052); AddImage(415, 23, 3604, 2052); AddImage(415, 199, 3604, 2052); AddImage(415, 291, 3604, 2052); AddImage(415, 377, 3604, 2052); #endregion //Header AddImage(150, 3, 1143, 2499); AddLabel(239, 5, 2590, "Enhancements"); //Guide AddButton(13, 9, 2094, 2095, 1, GumpButtonType.Reply, 0); AddLabel(7, -1, 149, "Guide"); #region Footers #region Images AddImage(23, 457, 96, 2401); AddImage(178, 457, 96, 2401); AddImage(245, 457, 96, 2401); AddImage(23, 456, 96, 2401); AddImage(178, 456, 96, 2401); AddImage(245, 456, 96, 2401); AddImage(296, 457, 96, 2401); AddImage(364, 457, 96, 2401); AddImage(296, 456, 96, 2401); AddImage(364, 456, 96, 2401); AddItem(411, 465, 4810, 2500); AddItem(210, 371, 14094, 2963); AddItem(26, 458, 8312, 2500); #endregion if (m_EnhancementsGumpObject.m_PageType == PageType.Customizations) { AddButton(64, 468, 9724, 9721, 2, GumpButtonType.Reply, 0); } else { AddButton(64, 468, 9721, 9724, 2, GumpButtonType.Reply, 0); } AddLabel(98, 476, 2603, "Customizations"); if (m_EnhancementsGumpObject.m_PageType == PageType.SpellHues) { AddButton(270, 470, 9724, 9721, 3, GumpButtonType.Reply, 0); } else { AddButton(270, 470, 9721, 9724, 3, GumpButtonType.Reply, 0); } AddLabel(304, 473, 2606, "Spell Hues"); if (m_EnhancementsGumpObject.m_PageType == PageType.Emotes) { AddButton(444, 470, 9724, 9721, 4, GumpButtonType.Reply, 0); } else { AddButton(444, 470, 9721, 9724, 4, GumpButtonType.Reply, 0); } AddLabel(480, 473, 2599, "Emotes"); #endregion switch (m_EnhancementsGumpObject.m_PageType) { #region Customizations case PageType.Customizations: int customizationStartIndex = m_EnhancementsGumpObject.m_Page * EntriesPerCustomizationPage; int customizationCount = Enum.GetNames(typeof(Enhancements.CustomizationType)).Length; int totalCustomizationPages = (int)(Math.Ceiling((double)customizationCount / (double)EntriesPerCustomizationPage)); if (m_EnhancementsGumpObject.m_Page < 0) { m_EnhancementsGumpObject.m_Page = 0; } if (m_EnhancementsGumpObject.m_Page >= totalCustomizationPages) { m_EnhancementsGumpObject.m_Page = totalCustomizationPages - 1; } int leftStartX = 35; int leftStartY = 35; int rightStartX = 300; int rightStartY = 35; int rowSpacing = 130; for (int a = 0; a < EntriesPerCustomizationPage; a++) { int customizationIndex = customizationStartIndex + a; if (customizationIndex >= customizationCount) { continue; } Enhancements.CustomizationType customizationType = (Enhancements.CustomizationType)customizationIndex; Enhancements.CustomizationEntry customizationEntry = Enhancements.GetCustomizationEntry(m_Player, customizationType); Enhancements.CustomizationDetail customizationDetail = Enhancements.GetCustomizationDetail(customizationType); if (customizationEntry == null) { customizationEntry = new Enhancements.CustomizationEntry(customizationType, false, false); } List <Enhancements.SpellHueType> m_AvailableHues = new List <Enhancements.SpellHueType>(); m_AvailableHues.Add(Enhancements.SpellHueType.Standard); //Left Side if (a < (EntriesPerCustomizationPage / 2)) { if (customizationEntry.m_Unlocked) { if (customizationEntry.m_Active) { AddLabel(leftStartX + 129, leftStartY + 16, 63, customizationDetail.m_CustomizationName); AddLabel(leftStartX + 156, leftStartY + 74, 63, "Active"); AddButton(leftStartX + 121, leftStartY + 71, 2154, 2151, 10 + a, GumpButtonType.Reply, 0); } else { AddLabel(leftStartX + 129, leftStartY + 16, 149, customizationDetail.m_CustomizationName); AddLabel(leftStartX + 156, leftStartY + 74, 149, "Inactive"); AddButton(leftStartX + 121, leftStartY + 71, 2151, 2154, 10 + a, GumpButtonType.Reply, 0); } } else { AddLabel(leftStartX + 129, leftStartY + 16, 149, customizationDetail.m_CustomizationName); AddLabel(leftStartX + 156, leftStartY + 74, 2401, "Not Acquired"); AddButton(leftStartX + 121, leftStartY + 71, 9721, 9721, 10 + a, GumpButtonType.Reply, 0); } AddBackground(leftStartX + 0, leftStartY + 0, 122, 122, 9270); AddImageTiled(leftStartX + 12, leftStartY + 12, 100, 100, 2624); AddLabel(leftStartX + 156, leftStartY + 41, 2550, "Info"); AddButton(leftStartX + 129, leftStartY + 44, 2117, 2118, 20 + a, GumpButtonType.Reply, 0); AddGumpCollection(GumpCollections.GetGumpCollection(customizationDetail.GumpCollectionId, -1), leftStartX, leftStartY); leftStartY += rowSpacing; } //Right Side else { if (customizationEntry.m_Unlocked) { if (customizationEntry.m_Active) { AddLabel(rightStartX + 129, rightStartY + 16, 63, customizationDetail.m_CustomizationName); AddLabel(rightStartX + 156, rightStartY + 74, 63, "Active"); AddButton(rightStartX + 121, rightStartY + 71, 2154, 2151, 10 + a, GumpButtonType.Reply, 0); } else { AddLabel(rightStartX + 129, rightStartY + 16, 149, customizationDetail.m_CustomizationName); AddLabel(rightStartX + 156, rightStartY + 74, 149, "Inactive"); AddButton(rightStartX + 121, rightStartY + 71, 2151, 2154, 10 + a, GumpButtonType.Reply, 0); } } else { AddLabel(rightStartX + 129, rightStartY + 16, 149, customizationDetail.m_CustomizationName); AddLabel(rightStartX + 156, rightStartY + 74, 2401, "Not Acquired"); AddButton(rightStartX + 121, rightStartY + 71, 9721, 9721, 10 + a, GumpButtonType.Reply, 0); } AddBackground(rightStartX + 0, rightStartY + 0, 122, 122, 9270); AddImageTiled(rightStartX + 12, rightStartY + 12, 100, 100, 2624); AddLabel(rightStartX + 156, rightStartY + 41, 2550, "Info"); AddButton(rightStartX + 129, rightStartY + 44, 2117, 2118, 20 + a, GumpButtonType.Reply, 0); AddGumpCollection(GumpCollections.GetGumpCollection(customizationDetail.GumpCollectionId, -1), rightStartX, rightStartY); rightStartY += rowSpacing; } } if (m_EnhancementsGumpObject.m_Page > 0) { AddButton(37, 428, 4014, 4016, 5, GumpButtonType.Reply, 0); AddLabel(71, 429, WhiteTextHue, "Previous Page"); } if (m_EnhancementsGumpObject.m_Page < totalCustomizationPages - 1) { AddButton(497, 428, 4005, 4007, 6, GumpButtonType.Reply, 0); AddLabel(427, 429, WhiteTextHue, "Next Page"); } break; #endregion #region Spell Hues case PageType.SpellHues: int spellHuesStartIndex = m_EnhancementsGumpObject.m_Page * EntriesPerSpellHuePage; int spellHuesCount = Enum.GetNames(typeof(Enhancements.SpellType)).Length; int totalSpellHuesPages = (int)(Math.Ceiling((double)spellHuesCount / (double)EntriesPerSpellHuePage)); if (m_EnhancementsGumpObject.m_Page < 0) { m_EnhancementsGumpObject.m_Page = 0; } if (m_EnhancementsGumpObject.m_Page >= totalSpellHuesPages) { m_EnhancementsGumpObject.m_Page = totalSpellHuesPages - 1; } leftStartX = 65; leftStartY = 65; rightStartX = 325; rightStartY = 65; rowSpacing = 130; for (int a = 0; a < EntriesPerSpellHuePage; a++) { int spellHueIndex = spellHuesStartIndex + a; if (spellHueIndex >= spellHuesCount) { continue; } Enhancements.SpellType spellType = (Enhancements.SpellType)spellHueIndex; Enhancements.SpellHueEntry spellHueEntry = Enhancements.GetSpellHueEntry(m_Player, spellType); Enhancements.SpellTypeDetail spellHueDetail = Enhancements.GetSpellTypeDetail(spellType); if (spellHueEntry == null) { spellHueEntry = new Enhancements.SpellHueEntry(spellType); } Enhancements.SpellHueTypeDetail spellHueTypeDetail = Enhancements.GetSpellHueTypeDetail(spellHueEntry.m_SelectedHue); List <Enhancements.SpellHueType> m_AvailableSpellHues = new List <Enhancements.SpellHueType>(); m_AvailableSpellHues.Add(Enhancements.SpellHueType.Standard); for (int b = 0; b < spellHueEntry.m_UnlockedHues.Count; b++) { if (spellHueEntry.m_UnlockedHues[b] == null) { continue; } m_AvailableSpellHues.Add(spellHueEntry.m_UnlockedHues[b]); } int spellHueTypeIndex = -1; spellHueTypeIndex = m_AvailableSpellHues.IndexOf(spellHueEntry.m_SelectedHue); //Left Side if (a < (EntriesPerSpellHuePage / 2)) { if (m_AvailableSpellHues.Count > 1) { if (spellHueTypeIndex > 0) { AddButton(leftStartX + 5, leftStartY + 66, 9909, 9909, 10 + a, GumpButtonType.Reply, 0); } if (spellHueTypeIndex < m_AvailableSpellHues.Count - 1) { AddButton(leftStartX + 40, leftStartY + 65, 9903, 9903, 20 + a, GumpButtonType.Reply, 0); } } AddBackground(leftStartX + 0, leftStartY + 0, 64, 61, 9270); AddItem(leftStartX + 10, leftStartY + 9, spellHueDetail.m_ItemID, spellHueTypeDetail.m_IconHue); AddLabel(leftStartX + 66, leftStartY + -1, 149, spellHueDetail.m_SpellName); AddLabel(leftStartX + 66, leftStartY + 19, spellHueTypeDetail.m_TextHue, spellHueTypeDetail.m_SpellHueTypeName); AddLabel(leftStartX + 66, leftStartY + 39, WhiteTextHue, "Hue: "); AddLabel(leftStartX + 96, leftStartY + 39, spellHueTypeDetail.m_TextHue, spellHueTypeDetail.m_SpellHue.ToString()); if (m_AvailableSpellHues.Count > 1) { AddLabel(leftStartX + 66, leftStartY + 66, WhiteTextHue, "Selected: " + (spellHueTypeIndex + 1).ToString() + " / " + m_AvailableSpellHues.Count.ToString()); } leftStartY += rowSpacing; } //Right Side else { if (m_AvailableSpellHues.Count > 1) { if (spellHueTypeIndex > 0) { AddButton(rightStartX + 5, rightStartY + 66, 9909, 9909, 10 + a, GumpButtonType.Reply, 0); } if (spellHueTypeIndex < m_AvailableSpellHues.Count - 1) { AddButton(rightStartX + 40, rightStartY + 65, 9903, 9903, 20 + a, GumpButtonType.Reply, 0); } } AddBackground(rightStartX + 0, rightStartY + 0, 64, 61, 9270); AddItem(rightStartX + 10, rightStartY + 9, spellHueDetail.m_ItemID, spellHueTypeDetail.m_IconHue); AddLabel(rightStartX + 66, rightStartY + -1, 149, spellHueDetail.m_SpellName); AddLabel(rightStartX + 66, rightStartY + 19, spellHueTypeDetail.m_TextHue, spellHueTypeDetail.m_SpellHueTypeName); AddLabel(rightStartX + 66, rightStartY + 39, WhiteTextHue, "Hue: "); AddLabel(rightStartX + 96, rightStartY + 39, spellHueTypeDetail.m_TextHue, spellHueTypeDetail.m_SpellHue.ToString()); if (m_AvailableSpellHues.Count > 1) { AddLabel(rightStartX + 66, rightStartY + 66, WhiteTextHue, "Selected: " + (spellHueTypeIndex + 1).ToString() + " / " + m_AvailableSpellHues.Count.ToString()); } rightStartY += rowSpacing; } } if (m_EnhancementsGumpObject.m_Page > 0) { AddButton(37, 428, 4014, 4016, 5, GumpButtonType.Reply, 0); AddLabel(71, 429, WhiteTextHue, "Previous Page"); } if (m_EnhancementsGumpObject.m_Page < totalSpellHuesPages - 1) { AddButton(497, 428, 4005, 4007, 6, GumpButtonType.Reply, 0); AddLabel(427, 429, WhiteTextHue, "Next Page"); } break; #endregion #region Emotes case PageType.Emotes: int emoteStartIndex = m_EnhancementsGumpObject.m_Page * EntriesPerEmotePage; int emoteCount = Enum.GetNames(typeof(Enhancements.EmoteType)).Length; int totalEmotesPages = (int)(Math.Ceiling((double)emoteCount / (double)EntriesPerEmotePage)); if (m_EnhancementsGumpObject.m_Page < 0) { m_EnhancementsGumpObject.m_Page = 0; } if (m_EnhancementsGumpObject.m_Page >= totalEmotesPages) { m_EnhancementsGumpObject.m_Page = totalEmotesPages - 1; } leftStartX = 75; leftStartY = 35; rightStartX = 320; rightStartY = 35; rowSpacing = 100; for (int a = 0; a < EntriesPerEmotePage; a++) { int emoteIndex = emoteStartIndex + a; if (emoteIndex >= emoteCount) { continue; } Enhancements.EmoteType emoteType = (Enhancements.EmoteType)emoteIndex; Enhancements.EmoteEntry emoteEntry = Enhancements.GetEmoteEntry(m_Player, emoteType); Enhancements.EmoteDetail emoteDetail = Enhancements.GetEmoteDetail(emoteType); if (emoteEntry == null) { emoteEntry = new Enhancements.EmoteEntry(emoteType, false); } //Left Side if (a < (EntriesPerEmotePage / 2)) { AddLabel(leftStartX + 89, leftStartY + 17, emoteDetail.m_Hue, emoteDetail.m_EmoteName); if (emoteEntry.m_Unlocked) { AddImage(leftStartX + 0, leftStartY + 0, 1417, 63); AddLabel(leftStartX + 89, leftStartY + 37, 63, "Unlocked"); } else { AddImage(leftStartX + 0, leftStartY + 0, 1417, 0); AddLabel(leftStartX + 89, leftStartY + 37, 2401, "Not Acquired"); } AddImage(leftStartX + 10, leftStartY + 9, 5576, emoteDetail.m_Hue); leftStartY += rowSpacing; } //Right Side else { AddLabel(rightStartX + 89, rightStartY + 17, emoteDetail.m_Hue, emoteDetail.m_EmoteName); if (emoteEntry.m_Unlocked) { AddImage(rightStartX + 0, rightStartY + 0, 1417, 63); AddLabel(rightStartX + 89, rightStartY + 37, 63, "Unlocked"); } else { AddImage(rightStartX + 0, rightStartY + 0, 1417, 0); AddLabel(rightStartX + 89, rightStartY + 37, 2401, "Not Acquired"); } AddImage(rightStartX + 10, rightStartY + 9, 5576, emoteDetail.m_Hue); rightStartY += rowSpacing; } } if (m_EnhancementsGumpObject.m_Page > 0) { AddButton(37, 428, 4014, 4016, 5, GumpButtonType.Reply, 0); AddLabel(71, 429, WhiteTextHue, "Previous Page"); } if (m_EnhancementsGumpObject.m_Page < totalEmotesPages - 1) { AddButton(497, 428, 4005, 4007, 6, GumpButtonType.Reply, 0); AddLabel(427, 429, WhiteTextHue, "Next Page"); } break; #endregion } }
public override void OnDoubleClick(Mobile from) { base.OnDoubleClick(from); PlayerMobile player = from as PlayerMobile; if (player == null) { return; } if (player.Backpack == null) { return; } if (!IsChildOf(player.Backpack)) { player.SendMessage("That must be in your pack in order to use it."); return; } EnhancementsPersistance.CheckAndCreateEnhancementsAccountEntry(player); Enhancements.SpellHueEntry entry = Enhancements.GetSpellHueEntry(player, m_SpellType); Enhancements.SpellTypeDetail spellTypeDetail = Enhancements.GetSpellTypeDetail(m_SpellType); Enhancements.SpellHueTypeDetail spellHueTypeDetail = Enhancements.GetSpellHueTypeDetail(m_SpellHueType); if (entry == null) { entry = new Enhancements.SpellHueEntry(m_SpellType); entry.m_UnlockedHues.Add(m_SpellHueType); player.m_EnhancementsAccountEntry.m_SpellHues.Add(entry); player.SendMessage("You unlock [" + spellTypeDetail.m_SpellName + ": " + spellHueTypeDetail.m_SpellHueTypeName + " - Hue " + spellHueTypeDetail.m_SpellHue.ToString() + "] on your account."); player.PlaySound(0x5C9); Delete(); } else { bool foundHue = false; foreach (Enhancements.SpellHueType spellHueType in entry.m_UnlockedHues) { if (spellHueType == null) { continue; } if (spellHueType == m_SpellHueType) { foundHue = true; } } if (foundHue) { player.SendMessage("You have already unlocked that hue for that particular spell."); } else { entry.m_UnlockedHues.Add(m_SpellHueType); player.SendMessage("You unlock [" + spellTypeDetail.m_SpellName + ": " + spellHueTypeDetail.m_SpellHueTypeName + " - Hue " + spellHueTypeDetail.m_SpellHue.ToString() + "] on your account."); player.PlaySound(0x5C9); Delete(); } } }