CODE |
XmlRecipesWeapons wrecipes = (XmlRecipesWeapons)XmlAttach.FindAttachment(from, typeof(XmlRecipesWeapons)); |
QUOTE (ArteGordon @ October 24, 2006 12:26 pm) |
InitCraft sets up all of the available crafts. To restrict access to crafts for different individuals, I would add the check to the CraftGump methods in CraftGump.cs such as CreateItemList that will allow you to control which items are listed for crafting. You will still need to initialize all of the possible additional crafts in InitCraft and then you can restrict them for certain individuals in those other methods. |
QUOTE (ArteGordon @ October 24, 2006 02:51 pm) |
the InitCraft method just sets up all of the possible craftable items for a specific crafting skill. CanCraft will allow you to test for individual crafted items when a player tries to make them. That is where you would make the check. Since InitCraft sets things up for all players there is no way with the system the way it is designed, to make it player-specific. You just have to restrict the items that can be crafted in CanCraft. By putting the check into the gump code, you can restrict the craftable items that are listed as well. |
QUOTE |
public void CreateItemList( int selectedGroup ) { if ( selectedGroup == 501 ) // 501 : Last 10 { CreateMakeLastList(); return; } CraftGroupCol craftGroupCol = m_CraftSystem.CraftGroups; CraftGroup craftGroup = craftGroupCol.GetAt( selectedGroup ); CraftItemCol craftItemCol = craftGroup.CraftItems; for ( int i = 0; i < craftItemCol.Count; ++i ) { int index = i % 10; CraftItem craftItem = craftItemCol.GetAt( i ); // try adding your check here on the craftItem using m_From as the player calling the gump, m_CraftSystem as the craft system being used, and m_Tool as the tool. // Something like if(craftItem is not a valid item for m_Player) continue; |
QUOTE (ArteGordon @ October 24, 2006 02:59 pm) | ||
in CraftGump.cs in the CreateItemList method, you could add a check here
|
CODE |
// try adding your check here on the craftItem using m_From as the player calling the gump, m_CraftSystem as the craft system being used, and m_Tool as the tool. // Something like if(!XmlRecipe.AllowCraft(m_From, m_CraftSystem, craftItem, m_Tool)) continue; |
CODE |
public static bool AllowCraft(Mobile from, CraftSystem system, CraftItem item, BaseTool tool) { // add whatever attachment checks you want here and return true/false depending on whether or not you want the item to appear on the list. Return true by default. return true; } |