Author Topic: simple configurable crafting system  (Read 2905 times)

also not sure if the client always downloads the weapon icons
I kind of remember some weapons just having the first letter as their icon
pretty sure this only happens if the icon is misnamed or just not there

I have both those coded (tested semi). It was for my second RPG which the code was supposed to be open sourced, which I'll upload to github in a bit if anyone wants to use the crafting class system as a base..
Link?

I uploaded it to github but realized you need some other classes with it (like requirements/includes). The crafting class looks like it uses the Stabilizer class and Inventory class (possibly). The idea was for each class to be standalone so the main functions you'd utilize probably are. Also, the METHOD links below tell you what each function does for it's class..


https://github.com/Elmling/Lob2



Here are the methods for the crafting class



Here are the methods for the menu class

Examples below ../Menus/menu_yesNo.txt:

1.

Code: [Select]
if(isObject($menu::YesNo))
$menu::YesNo.delete();

$menu::YesNo = $class::menuSystem.newMenuObject("YesNo","Menu YesNo");
$menu::YesNo.addMenuItem("Yes","%a=1");
$menu::YesNo.addMenuItem("No","%a=1");

2. (little more functionality)

In ../Menus/menu_crafting_wood.txt:

Code: [Select]
if(isObject($menu::Crafting))
$menu::Crafting.delete();

$menu::Crafting = $class::menuSystem.newMenuObject("Crafting","What would you like to do to the Wood?");

$menu::Crafting.setname("CraftingMenu");
$menu::Crafting.class = "CraftingMenu";

$menu::Crafting.addMenuItem("Craft Bow Handle","$menu::crafting.setTempBody(\"Enter an Amount or type ALL\");$menu::crafting.showInputMenu(#CLIENT);");//"$menu::Crafting.showInputMenu(#CLIENT);");
$menu::Crafting.addMenuItem("Craft Handle (for weapons/tools)","$menu::crafting.setTempBody(\"Enter an Amount or type ALL\");$menu::crafting.showInputMenu(#CLIENT);");//"$class::Crafting.ageSelected(#CLIENT.ndSelection);");
$menu::Crafting.addMenuItem("Craft Arrow Shafts","");//"$class::Crafting.useColors(#CLIENT.ndSelection);");

package class_menu_crafting_wood
{
function menuObject::onInputValueRecieved(%this,%client,%value)
{
if(%this.name $= "crafting")
{
%selected = %this.selected[%client];
if(%selected $= "craft arrow Shafts")
{
%type = "Arrow Shafts";
}
else
if(%selected $= "craft handle (for weapons/tools)")
{
%type = "Handle";
}
else
if(%selected $= "Craft Bow handle")
{
%type = "Bow Handle";
}

%inventoryItemSelected = getWord(%client.lastInventoryItemSelected,0);
%recipe = $class::crafting.getRecipe(%inventoryItemSelected @ " " @ %type);

if(!isObject(%recipe))
{
talk("The wood classes are: Pine, Oak, Willow, Maple");
return parent::onInputValueRecieved(%this,%client,%value);
}
%client.craftingStart(%recipe,%value);
}
return parent::onInputValueRecieved(%this,%client,%value);
}
};
activatePackage(class_menu_crafting_wood);

« Last Edit: December 29, 2017, 10:16:16 PM by elm »