public virtual bool WriteRecipe( BaseRecipe recipe ) { if ( recipe.RootParent != m_Crafter ) { m_LastMessage = "That needs to be in your pack."; return false; } else if ( m_Components.Count == 0 ) { m_LastMessage = "There are no components to write down."; return false; } recipe.ComponentTypes = new Type[m_GumpComponents.Length]; for( int i = 0; i<m_GumpComponents.Length; i++ ) recipe.ComponentTypes[i] = m_GumpComponents[i].Type; return true; }
public override bool WriteRecipe( BaseRecipe recipe ) { if ( !(recipe is ToxinRecipe) ) { LastMessage = "That is not a valid toxin recipe."; return false; } if ( base.WriteRecipe( recipe ) ) { ToxinRecipe trecipe = recipe as ToxinRecipe; trecipe.BottleID = m_BottleID; trecipe.ToxinName = m_Name; trecipe.Name = "toxin recipe for: " + m_Name; return true; } else return false; }
public virtual bool ReadRecipe( BaseRecipe recipe ) { if ( recipe.ComponentTypes == null ) { m_LastMessage = "This recipe is blank."; return false; } m_GumpComponents = new GumpComponent[recipe.ComponentTypes.Length]; for ( int i=0; i<recipe.ComponentTypes.Length; i++ ) { m_GumpComponents[i] = new GumpComponent(); if ( recipe.ComponentTypes[i] == null ) continue; Item instance = (Item)Activator.CreateInstance(recipe.ComponentTypes[i]); if ( !AddComponent( instance, i, true ) ) { m_LastMessage = "You cannot use one or more of the listed components."; Update(); return false; } } m_LastMessage = "You successfully add the components according to the recipe."; Update(); return true; // success }
public override bool ReadRecipe( BaseRecipe recipe ) { if ( !(recipe is ToxinRecipe) ) { LastMessage = "That is not a valid toxin recipe."; return false; } if ( base.ReadRecipe( recipe ) ) { ToxinRecipe trecipe = recipe as ToxinRecipe; m_BottleID = trecipe.BottleID; m_Name = trecipe.ToxinName; return true; } else return false; }