public CraftGroup(TextDefinition groupName) { NameNumber = groupName; NameString = groupName; CraftItems = new CraftItemCol(); }
public CraftGroup(TextDefinition groupName) { m_NameNumber = groupName; m_NameString = groupName; m_arCraftItem = new CraftItemCol(); }
public override void OnDoubleClick(Mobile from) { if (EventItem) { return; } if (PotionGroupIndex == -1) { from.SendAsciiMessage("You don't know how to use that."); return; } if (DefAlchemy.CraftSystem.CraftGroups.Count - 1 < PotionGroupIndex) { return; } if (from.Backpack.FindItemByType(typeof(Bottle)) == null) { from.SendAsciiMessage("You don't have any bottles for this potion."); return; } BaseTool toolToUse = null; foreach (BaseTool t in from.Backpack.FindItemsByType(typeof(BaseTool))) { if (t.CraftSystem == DefAlchemy.CraftSystem) { toolToUse = t; break; } } if (toolToUse == null) { from.SendAsciiMessage("You don't have a mortar and pestle."); return; } CraftItem cI = null; if (PotionIndex == -1) { CraftItemCol craftItemCol = DefAlchemy.CraftSystem.CraftGroups.GetAt(PotionGroupIndex).CraftItems; for (int i = craftItemCol.Count - 1; i >= 0; --i) { CraftItem localCI = craftItemCol.GetAt(i); if (localCI.Resources.GetAt(0).Amount <= Amount && localCI.Skills.GetAt(0).MinSkill <= from.Skills.Alchemy.Base) { cI = localCI; break; } if (i == 0 && cI == null) { if (localCI.Skills.GetAt(0).MinSkill > from.Skills.Alchemy.Base) { from.SendAsciiMessage(notSkilledEnough); } else if (localCI.Resources.GetAt(0).Amount > Amount) { from.SendAsciiMessage(notEnoughRegs); } } } } else { if (DefAlchemy.CraftSystem.CraftGroups.Count - 1 >= PotionIndex && DefAlchemy.CraftSystem.CraftGroups.GetAt(PotionGroupIndex).CraftItems.Count - 1 >= PotionIndex) { cI = DefAlchemy.CraftSystem.CraftGroups.GetAt(PotionGroupIndex).CraftItems.GetAt(PotionIndex); if (cI.Skills.GetAt(0).MinSkill > from.Skills.Alchemy.Base) { from.SendAsciiMessage(notSkilledEnough); cI = null; } else if (cI.Resources.GetAt(0).Amount > Amount) { from.SendAsciiMessage(notEnoughRegs); cI = null; } } } if (cI != null && from.Combatant == null) { //if (from is PlayerMobile) // ((PlayerMobile)from).AbortCurrentPlayerAction(); DefAlchemy.CraftSystem.CreateItem(from, cI.ItemType, cI.Resources.GetAt(0).ItemType, toolToUse, cI, false); } else if (from.Combatant != null) { from.SendAsciiMessage("Can't do that while in combat."); } base.OnDoubleClick(from); }
public CraftGroup( TextDefinition groupName ) { m_NameNumber = groupName; m_NameString = groupName; m_arCraftItem = new CraftItemCol(); }
public ItemListEntry[] CreateItemList() { CraftGroupCol craftGroupCol = CurrentCraftSystem.CraftGroups; CraftGroup craftGroup = craftGroupCol.GetAt(SelectedGroupIndex); CraftItemCol craftItemCol = craftGroup.CraftItems; ItemListEntry[] toReturn = new ItemListEntry[craftItemCol.Count + 1]; toReturn[0] = new ItemListEntry("Previous menu", 4766);//Previous page int hue = 0; if (CurrentCraftSystem.CraftSubRes.Init && CurrentCraftSystem.CraftSubRes.Count >= 1 && SelectedResType != CurrentCraftSystem.CraftSubRes.GetAt(0).ItemType) { hue = ResourceInfoList[CurrentCraftSystem.CraftSubRes.GetAt(SelectedResourceIndex)].Hue; } if (hue > 1) { --hue; } string resourceList = string.Empty; for (int i = 0; i < craftItemCol.Count; ++i) { CraftItem craftItem = craftItemCol.GetAt(i); //Get the item id and resources required for the items int itemID; if (craftItemCol.Count >= 1) { itemID = CraftItem.ItemIDOf(craftItemCol.GetAt(i).ItemType); int amount = CurrentCraftSystem.CraftGroups.GetAt(SelectedGroupIndex).CraftItems.GetAt(i).Resources.GetAt(0).Amount; if (SelectedResType == null) { if (!string.IsNullOrEmpty(CurrentCraftSystem.CraftGroups.GetAt(SelectedGroupIndex).CraftItems.GetAt(i).Resources.GetAt(0).NameString)) { resourceList = string.Format(" [{0} {1}]", resourceList, amount); } else if (CurrentCraftSystem.CraftGroups.GetAt(SelectedGroupIndex).CraftItems.GetAt(i).Resources.GetAt(0).NameNumber > 0) { resourceList = string.Format(" [{0} {1}]", amount, CliLoc.LocToString(CurrentCraftSystem.CraftGroups.GetAt(SelectedGroupIndex).CraftItems.GetAt(i).Resources.GetAt(0).NameNumber)); } } else { resourceList = string.Format(" [{0} {1}]", amount, CraftResources.GetName(CraftResources.GetFromType(SelectedResType))); } } else { itemID = 5360; //Deed ID } //Becomes 0 if we use a string instead if (craftItem.NameNumber > 0) { toReturn[i + 1] = new ItemListEntry(CliLoc.LocToString(craftItem.NameNumber) + resourceList, itemID, hue); } else { toReturn[i + 1] = new ItemListEntry(craftItem.NameString + resourceList, itemID, hue); } } return(toReturn); }