public static void RewardTokens(Mobile m, int amount) { if (amount < 1) { return; } MasterStorageUtils.GiveTypeToPlayer(m as PlayerMobile, typeof(Daat99Tokens), amount, true); }
private CraftGump(Mobile from, CraftSystem craftSystem, BaseTool tool, object notice, CraftPage page) : base(40, 40) { this.m_From = from; this.m_CraftSystem = craftSystem; this.m_Tool = tool; this.m_Page = page; CraftContext context = craftSystem.GetContext(from); from.CloseGump(typeof(CraftGump)); from.CloseGump(typeof(CraftGumpItem)); this.AddPage(0); AddBackground(0, 0, 530, 497, 5054); AddImageTiled(10, 10, 510, 22, 2624); AddImageTiled(10, 292, 150, 45, 2624); AddImageTiled(165, 292, 355, 45, 2624); AddImageTiled(10, 342, 510, 145, 2624); AddImageTiled(10, 37, 200, 250, 2624); AddImageTiled(215, 37, 305, 250, 2624); AddAlphaRegion(10, 10, 510, 477); if (craftSystem.GumpTitleNumber > 0) { this.AddHtmlLocalized(10, 12, 510, 20, craftSystem.GumpTitleNumber, LabelColor, false, false); } else { this.AddHtml(10, 12, 510, 20, craftSystem.GumpTitleString, false, false); } AddHtmlLocalized(10, 37, 200, 22, 1044010, LabelColor, false, false); // <CENTER>CATEGORIES</CENTER> AddHtmlLocalized(215, 37, 305, 22, 1044011, LabelColor, false, false); // <CENTER>SELECTIONS</CENTER> AddHtmlLocalized(10, 302, 150, 25, 1044012, LabelColor, false, false); // <CENTER>NOTICES</CENTER> this.AddButton(15, 442, 4017, 4019, 0, GumpButtonType.Reply, 0); this.AddHtmlLocalized(50, 445, 150, 18, 1011441, LabelColor, false, false); // EXIT this.AddButton(115, 442, 4017, 4019, GetButtonID(6, 11), GumpButtonType.Reply, 0); this.AddHtmlLocalized(150, 445, 150, 18, 1112698, LabelColor, false, false); // CANCEL MAKE // Repair option if (m_CraftSystem.Repair) { AddButton(270, 342, 4005, 4007, GetButtonID(6, 5), GumpButtonType.Reply, 0); AddHtmlLocalized(305, 345, 150, 18, 1044260, LabelColor, false, false); // REPAIR ITEM } // **************************************** // Mark option if (m_CraftSystem.MarkOption) { AddButton(270, 362, 4005, 4007, GetButtonID(6, 6), GumpButtonType.Reply, 0); AddHtmlLocalized(305, 365, 150, 18, 1044017 + (context == null ? 0 : (int)context.MarkOption), LabelColor, false, false); // MARK ITEM } // **************************************** // Enhance option if (m_CraftSystem.CanEnhance) { AddButton(270, 382, 4005, 4007, GetButtonID(6, 8), GumpButtonType.Reply, 0); AddHtmlLocalized(305, 385, 150, 18, 1061001, LabelColor, false, false); // ENHANCE ITEM } // **************************************** #region SA // Alter option if (Core.SA && m_CraftSystem.CanAlter) { AddButton(270, 402, 4005, 4007, GetButtonID(6, 9), GumpButtonType.Reply, 0); AddHtmlLocalized(304, 405, 250, 18, 1094726, LabelColor, false, false); // ALTER ITEM (Gargoyle) } // **************************************** // Quest item if (Core.SA) { AddButton(270, 422, 4005, 4007, GetButtonID(6, 10), GumpButtonType.Reply, 0); AddHtmlLocalized(305, 425, 150, 18, context != null && context.QuestOption == CraftQuestOption.QuestItem ? 1112534 : 1112533, LabelColor, false, false); // QUEST ITEM } // **************************************** #endregion AddButton(270, 442, 4005, 4007, GetButtonID(6, 2), GumpButtonType.Reply, 0); AddHtmlLocalized(305, 445, 150, 18, 1044013, LabelColor, false, false); // MAKE LAST #region Stygian Abyss int total = 1; int made = 0; if (Locked && AutoCraftTimer.AutoCraftTable.ContainsKey(m_From)) { AutoCraftTimer timer = AutoCraftTimer.AutoCraftTable[m_From]; if (timer != null) { total = timer.Amount; made = timer.Attempts; } else { if (context != null) { total = context.MakeTotal; } } } string args = String.Format("{0}\t{1}", made.ToString(), total.ToString()); AddHtmlLocalized(270, 468, 150, 18, 1079443, args, LabelColor, false, false); //~1_DONE~/~2_TOTAL~ COMPLETED #endregion // Resmelt option if (m_CraftSystem.Resmelt) { AddButton(15, 342, 4005, 4007, GetButtonID(6, 1), GumpButtonType.Reply, 0); AddHtmlLocalized(50, 345, 150, 18, 1044259, LabelColor, false, false); // SMELT ITEM } // **************************************** if (notice is int && (int)notice > 0) { this.AddHtmlLocalized(170, 295, 350, 40, (int)notice, LabelColor, false, false); } else if (notice is string) { this.AddHtml(170, 295, 350, 40, String.Format("<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", FontColor, notice), false, false); } // If the system has more than one resource if (craftSystem.CraftSubRes.Init) { string nameString = craftSystem.CraftSubRes.NameString; int nameNumber = craftSystem.CraftSubRes.NameNumber; int resIndex = (context == null ? -1 : context.LastResourceIndex); Type resourceType = craftSystem.CraftSubRes.ResType; //Type resourceType2 = GetAltType(resourceType); if (resIndex > -1) { CraftSubRes subResource = craftSystem.CraftSubRes.GetAt(resIndex); nameString = subResource.NameString; nameNumber = subResource.NameNumber; resourceType = subResource.ItemType; } int resourceCount = 0; if (from.Backpack != null) { Item[] items = from.Backpack.FindItemsByType(resourceType, true); for (int i = 0; i < items.Length; ++i) { resourceCount += items[i].Amount; } //daat99 OWLTR start - craft from storage ulong storageCount = MasterStorageUtils.GetPlayersStorageItemCount(from as Mobiles.PlayerMobile, resourceType); if (storageCount > 0) { if (storageCount < int.MaxValue && storageCount + (ulong)resourceCount < int.MaxValue) { resourceCount += (int)storageCount; } else { resourceCount = int.MaxValue; } } //daat99 OWLTR end - craft from storage } this.AddButton(15, 382, 4005, 4007, GetButtonID(6, 0), GumpButtonType.Reply, 0); if (nameNumber > 0) { if (context.DoNotColor) { AddLabel(50, 385, LabelHue, "*"); } AddHtmlLocalized(50 + (context.DoNotColor ? 13 : 0), 385, 250, 18, nameNumber, resourceCount.ToString(), LabelColor, false, false); } else { AddLabel(50, 382, LabelHue, (context.DoNotColor ? "*" : "") + String.Format("{0} ({1} Available)", nameString, resourceCount)); } } // **************************************** // For dragon scales if (craftSystem.CraftSubRes2.Init) { string nameString = craftSystem.CraftSubRes2.NameString; int nameNumber = craftSystem.CraftSubRes2.NameNumber; int resIndex = (context == null ? -1 : context.LastResourceIndex2); Type resourceType = craftSystem.CraftSubRes2.ResType; if (resIndex > -1) { CraftSubRes subResource = craftSystem.CraftSubRes2.GetAt(resIndex); nameString = subResource.NameString; nameNumber = subResource.NameNumber; resourceType = subResource.ItemType; } int resourceCount = 0; if (from.Backpack != null) { Item[] items = from.Backpack.FindItemsByType(resourceType, true); for (int i = 0; i < items.Length; ++i) { resourceCount += items[i].Amount; } //daat99 OWLTR start - craft from storage ulong storageCount = MasterStorageUtils.GetPlayersStorageItemCount(from as Mobiles.PlayerMobile, resourceType); if (storageCount > 0) { if (storageCount < int.MaxValue && storageCount + (ulong)resourceCount < int.MaxValue) { resourceCount += (int)storageCount; } else { resourceCount = int.MaxValue; } } //daat99 OWLTR end - craft from storage } this.AddButton(15, 402, 4005, 4007, GetButtonID(6, 7), GumpButtonType.Reply, 0); if (nameNumber > 0) { AddHtmlLocalized(50, 405, 250, 18, nameNumber, resourceCount.ToString(), LabelColor, false, false); } else { AddLabel(50, 405, LabelHue, String.Format("{0} ({1} Available)", nameString, resourceCount)); } } // **************************************** this.CreateGroupList(); if (page == CraftPage.PickResource) { this.CreateResList(false, from); } else if (page == CraftPage.PickResource2) { this.CreateResList(true, from); } else if (context != null && context.LastGroupIndex > -1) { this.CreateItemList(context.LastGroupIndex); } }
public void CreateResList(bool opt, Mobile from) { CraftSubResCol res = (opt ? this.m_CraftSystem.CraftSubRes2 : this.m_CraftSystem.CraftSubRes); //daat99 OWLTR start - recipe craft bool b_RecipeCraft = OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.RECIPE_CRAFT), b_Blacksmithy = OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.BLACKSMITH_RECIPES), b_BowFletching = OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.BOWFLETCH_RECIPES), b_Carpentry = OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.CARPENTRY_RECIPES), b_Masonry = OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.MASONRY_RECIPES), b_Tailoring = OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.TAILORING_RECIPES), b_Tinkering = OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.TINKERING_RECIPES); if (b_RecipeCraft) { NewDaat99Holder dh = (NewDaat99Holder)daat99.Daat99OWLTR.TempHolders[m_From]; int i_Lenght = 0; for (int i = 0; i < res.Count; ++i) { int index = i_Lenght % 10; CraftSubRes subResource = res.GetAt(i); if (!dh.Resources.Contains(CraftResources.GetFromType(subResource.ItemType)) || (!b_Blacksmithy && m_CraftSystem is DefBlacksmithy) || (!b_BowFletching && m_CraftSystem is DefBowFletching) || (!b_Carpentry && m_CraftSystem is DefCarpentry) || (!b_Masonry && m_CraftSystem is DefMasonry) || (!b_Tailoring && m_CraftSystem is DefTailoring) || (!b_Tinkering && m_CraftSystem is DefTinkering)) { if (index == 0) { if (i > 0) { AddButton(485, 260, 4005, 4007, 0, GumpButtonType.Page, (i / 10) + 1); } AddPage((i / 10) + 1); if (i > 0) { AddButton(455, 260, 4014, 4015, 0, GumpButtonType.Page, i / 10); } CraftContext context = m_CraftSystem.GetContext(m_From); AddButton(220, 260, 4005, 4007, GetButtonID(6, 4), GumpButtonType.Reply, 0); AddHtmlLocalized(255, 263, 200, 18, (context == null || !context.DoNotColor) ? 1061591 : 1061590, LabelColor, false, false); } AddButton(220, 60 + (index * 20), 4005, 4007, GetButtonID(5, i), GumpButtonType.Reply, 0); if (subResource.NameNumber > 0) { AddHtmlLocalized(255, 63 + (index * 20), 250, 18, subResource.NameNumber, LabelColor, false, false); } else { AddLabel(255, 60 + (index * 20), LabelHue, subResource.NameString); } i_Lenght++; } } } else { //daat99 OWLTR end - recipe craft for (int i = 0; i < res.Count; ++i) { int index = i % 10; CraftSubRes subResource = res.GetAt(i); if (index == 0) { if (i > 0) { this.AddButton(485, 290, 4005, 4007, 0, GumpButtonType.Page, (i / 10) + 1); } this.AddPage((i / 10) + 1); if (i > 0) { this.AddButton(455, 290, 4014, 4015, 0, GumpButtonType.Page, i / 10); } CraftContext context = this.m_CraftSystem.GetContext(this.m_From); this.AddButton(220, 290, 4005, 4007, GetButtonID(6, 4), GumpButtonType.Reply, 0); this.AddHtmlLocalized(255, 293, 200, 18, (context == null || !context.DoNotColor) ? 1061591 : 1061590, LabelColor, false, false); } int resourceCount = 0; if (from.Backpack != null) { Item[] items = from.Backpack.FindItemsByType(subResource.ItemType, true); for (int j = 0; j < items.Length; ++j) { resourceCount += items[j].Amount; } //daat99 OWLTR start - craft from storage ulong storageCount = MasterStorageUtils.GetPlayersStorageItemCount(from as Mobiles.PlayerMobile, subResource.ItemType); if (storageCount > 0) { if (storageCount < int.MaxValue && storageCount + (ulong)resourceCount < int.MaxValue) { resourceCount += (int)storageCount; } else { resourceCount = int.MaxValue; } } //daat99 OWLTR end - craft from storage } this.AddButton(220, 70 + (index * 20), 4005, 4007, GetButtonID(5, i), GumpButtonType.Reply, 0); if (subResource.NameNumber > 0) { this.AddHtmlLocalized(255, 73 + (index * 20), 250, 18, subResource.NameNumber, resourceCount.ToString(), LabelColor, false, false); } else { this.AddLabel(255, 70 + (index * 20), LabelHue, String.Format("{0} ({1})", subResource.NameString, resourceCount)); } } } }
private CraftGump(Mobile from, CraftSystem craftSystem, BaseTool tool, object notice, CraftPage page) : base(40, 40) { this.m_From = from; this.m_CraftSystem = craftSystem; this.m_Tool = tool; this.m_Page = page; CraftContext context = craftSystem.GetContext(from); from.CloseGump(typeof(CraftGump)); from.CloseGump(typeof(CraftGumpItem)); this.AddPage(0); this.AddBackground(0, 0, 550, 587, 5054); this.AddImageTiled(10, 10, 530, 22, 2624); //Section for Gump Heading this.AddImageTiled(10, 375, 132, 45, 2624); //Section for Notices this.AddImageTiled(146, 375, 395, 45, 2624); //Section across from Notices this.AddImageTiled(10, 422, 530, 155, 2624); //Section where Exit is this.AddImageTiled(10, 37, 200, 335, 2624); //Section for Categories this.AddImageTiled(215, 37, 325, 335, 2624); //Section for Sublisted Items this.AddAlphaRegion(10, 10, 530, 567); if (craftSystem.GumpTitleNumber > 0) { this.AddHtmlLocalized(10, 12, 510, 20, craftSystem.GumpTitleNumber, LabelColor, false, false); } else { this.AddHtml(10, 12, 510, 20, craftSystem.GumpTitleString, false, false); } this.AddHtmlLocalized(10, 37, 200, 22, 1044010, LabelColor, false, false); // <CENTER>CATEGORIES</CENTER> this.AddHtmlLocalized(215, 37, 305, 22, 1044011, LabelColor, false, false); // <CENTER>SELECTIONS</CENTER> this.AddHtmlLocalized(10, 385, 150, 25, 1044012, LabelColor, false, false); // <CENTER>NOTICES</CENTER> this.AddButton(15, 542, 4017, 4019, 0, GumpButtonType.Reply, 0); this.AddHtmlLocalized(50, 545, 150, 18, 1011441, LabelColor, false, false); // EXIT this.AddButton(270, 542, 4005, 4007, GetButtonID(6, 2), GumpButtonType.Reply, 0); this.AddHtmlLocalized(305, 545, 150, 18, 1044013, LabelColor, false, false); // MAKE LAST this.AddButton(270, 502, 4005, 4007, GetButtonID(6, 9), GumpButtonType.Reply, 0); this.AddLabel(304, 505, 1152, @"ALTER ITEM (GARGOYLE)"); this.AddButton(270, 522, 4005, 4007, GetButtonID(6, 10), GumpButtonType.Reply, 0); this.AddHtmlLocalized(305, 525, 150, 18, 1112533 + (context == null ? 0 : (int)context.QuestOption), LabelColor, false, false); // QUEST ITEM this.AddButton(115, 542, 4017, 4019, GetButtonID(6, 11), GumpButtonType.Reply, 0); this.AddHtmlLocalized(150, 545, 150, 18, 1112698, LabelColor, false, false); // CANCEL MAKE // Mark option if (craftSystem.MarkOption) { this.AddButton(270, 462, 4005, 4007, GetButtonID(6, 6), GumpButtonType.Reply, 0); this.AddHtmlLocalized(305, 465, 150, 18, 1044017 + (context == null ? 0 : (int)context.MarkOption), LabelColor, false, false); // MARK ITEM } // **************************************** // Resmelt option if (craftSystem.Resmelt) { this.AddButton(15, 442, 4005, 4007, GetButtonID(6, 1), GumpButtonType.Reply, 0); this.AddHtmlLocalized(50, 445, 150, 18, 1044259, LabelColor, false, false); // SMELT ITEM } // **************************************** // Repair option if (craftSystem.Repair) { this.AddButton(270, 442, 4005, 4007, GetButtonID(6, 5), GumpButtonType.Reply, 0); this.AddHtmlLocalized(305, 445, 150, 18, 1044260, LabelColor, false, false); // REPAIR ITEM } // **************************************** // Enhance option if (craftSystem.CanEnhance) { this.AddButton(270, 482, 4005, 4007, GetButtonID(6, 8), GumpButtonType.Reply, 0); this.AddHtmlLocalized(305, 485, 150, 18, 1061001, LabelColor, false, false); // ENHANCE ITEM } // **************************************** if (notice is int && (int)notice > 0) { this.AddHtmlLocalized(170, 377, 350, 40, (int)notice, LabelColor, false, false); } else if (notice is string) { this.AddHtml(170, 377, 350, 40, String.Format("<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", FontColor, notice), false, false); } // If the system has more than one resource if (craftSystem.CraftSubRes.Init) { string nameString = craftSystem.CraftSubRes.NameString; int nameNumber = craftSystem.CraftSubRes.NameNumber; int resIndex = (context == null ? -1 : context.LastResourceIndex); Type resourceType = craftSystem.CraftSubRes.ResType; if (resIndex > -1) { CraftSubRes subResource = craftSystem.CraftSubRes.GetAt(resIndex); nameString = subResource.NameString; nameNumber = subResource.NameNumber; resourceType = subResource.ItemType; } int resourceCount = 0; if (from.Backpack != null) { Item[] items = from.Backpack.FindItemsByType(resourceType, true); for (int i = 0; i < items.Length; ++i) { resourceCount += items[i].Amount; } //daat99 OWLTR start - craft from storage ulong storageCount = MasterStorageUtils.GetPlayersStorageItemCount(from as Mobiles.PlayerMobile, resourceType); if (storageCount > 0) { if (storageCount < int.MaxValue && storageCount + (ulong)resourceCount < int.MaxValue) { resourceCount += (int)storageCount; } else { resourceCount = int.MaxValue; } } //daat99 OWLTR end - craft from storage } this.AddButton(15, 462, 4005, 4007, GetButtonID(6, 0), GumpButtonType.Reply, 0); if (nameNumber > 0) { this.AddHtmlLocalized(50, 465, 250, 18, nameNumber, resourceCount.ToString(), LabelColor, false, false); } else { this.AddLabel(50, 465, LabelHue, String.Format("{0} ({1} Available)", nameString, resourceCount)); } } // **************************************** // For dragon scales if (craftSystem.CraftSubRes2.Init) { string nameString = craftSystem.CraftSubRes2.NameString; int nameNumber = craftSystem.CraftSubRes2.NameNumber; int resIndex = (context == null ? -1 : context.LastResourceIndex2); Type resourceType = craftSystem.CraftSubRes2.ResType; if (resIndex > -1) { CraftSubRes subResource = craftSystem.CraftSubRes2.GetAt(resIndex); nameString = subResource.NameString; nameNumber = subResource.NameNumber; resourceType = subResource.ItemType; } int resourceCount = 0; if (from.Backpack != null) { Item[] items = from.Backpack.FindItemsByType(resourceType, true); for (int i = 0; i < items.Length; ++i) { resourceCount += items[i].Amount; } //daat99 OWLTR start - craft from storage ulong storageCount = MasterStorageUtils.GetPlayersStorageItemCount(from as Mobiles.PlayerMobile, resourceType); if (storageCount > 0) { if (storageCount < int.MaxValue && storageCount + (ulong)resourceCount < int.MaxValue) { resourceCount += (int)storageCount; } else { resourceCount = int.MaxValue; } } //daat99 OWLTR end - craft from storage } this.AddButton(15, 482, 4005, 4007, GetButtonID(6, 7), GumpButtonType.Reply, 0); if (nameNumber > 0) { this.AddHtmlLocalized(50, 485, 250, 18, nameNumber, resourceCount.ToString(), LabelColor, false, false); } else { this.AddLabel(50, 485, LabelHue, String.Format("{0} ({1} Available)", nameString, resourceCount)); } } // **************************************** this.CreateGroupList(); if (page == CraftPage.PickResource) { this.CreateResList(false, from); } else if (page == CraftPage.PickResource2) { this.CreateResList(true, from); } else if (context != null && context.LastGroupIndex > -1) { this.CreateItemList(context.LastGroupIndex); } }
public static bool TakePlayerTokens(PlayerMobile player, int amount, bool informPlayer) { return(MasterStorageUtils.TakeTypeFromPlayer(player, typeof(Daat99Tokens), amount, informPlayer)); }
public static bool GiveTokensToPlayer(PlayerMobile player, int amount, bool informPlayer) { return(MasterStorageUtils.GiveTypeToPlayer(player, typeof(Daat99Tokens), amount, informPlayer)); }
public virtual bool ConsumeReagents() { if (this.m_Scroll != null || !this.m_Caster.Player) { return(true); } if (AosAttributes.GetValue(this.m_Caster, AosAttribute.LowerRegCost) > Utility.Random(100)) { return(true); } if (Engines.ConPVP.DuelContext.IsFreeConsume(this.m_Caster)) { return(true); } Container pack = this.m_Caster.Backpack; if (pack == null) { return(false); } if (pack.ConsumeTotal(this.m_Info.Reagents, this.m_Info.Amounts) == -1) { return(true); } //daat99 OWLTR start - use SpellCastersKey if (OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.USE_STORAGE_RESOURCES) && MasterStorageUtils.ConsumePlayersStorageItems(m_Caster as PlayerMobile, m_Info.Reagents, m_Info.Amounts)) { return(true); } //daat99 OWLTR end - use SpellCastersKey return(false); }