|
||
|
|
#1 (permalink) |
|
Join Date: Feb 2004
Location: Canada eh
Posts: 413
|
Summary:
This file set implements three things: 1) Fixes a small bug I reported in Beta36 that missed the cut for v1 RC0 2) Adds new flexibility in using either string or cliloc entries when calling AddCraft and Subsquent methods. 3) Extends the Crafting subsystem to be able to handle crafting objects that require parameters on their constructor. Description: This fixes this bug: Stat Gain Extends the AddCraft method by replacing all of 24 permutations of overloaded signatures with 4 main signatures that use objects as the passed parameter type instead of the permutations of string and int. This would fix MANY peoples problems with finding the correct signature to use and also adds a few permutations that were not allowed in the original. See the following for discussions that could have been not rquired or greatly simplified: light shedding property for items http://www.runuo.com/forum/showthread.php?t=33856 Faster Gain [SetMy Further extends the AddCraft method by adding 4 more prototypes that accept an array of type object to be used as constructor parameters on the subsequent item creation. See: Ever been accused of ...... http://www.runuo.com/forum/showthread.php?t=31788 Some examples of usages possible in this new variant: Code:
// Components
AddCraft( typeof( Rope ), "Components", 1020934, SkillName.Tailoring, 20.0, 45.0, typeof( SpoolOfThread ), 1024000, 5, "You do not have sufficient thread to make that." );
AddCraft( typeof( Rope ), 1011155, "Rope", SkillName.Tailoring, 20.0, 45.0, typeof( SpoolOfThread ), 1024000, 5, "You do not have sufficient thread to make that." );
AddCraft( typeof( Rope ), 1011155, 1020934, SkillName.Tailoring, 20.0, 45.0, typeof( SpoolOfThread ), "Thread", 5, "You do not have sufficient thread to make that." );
AddCraft( typeof( Rope ), 1011155, 1020934, SkillName.Tailoring, 20.0, 45.0, typeof( SpoolOfThread ), 1024000, 5, 1042081 );
AddCraft( typeof( Rope ), 1011155, 1020934, SkillName.Tailoring, 20.0, 45.0, typeof( SpoolOfThread ), 1024000, 5, "You do not have sufficient thread to make that.", new object[] {10} );// MAKES 10 piles of rope by virtue of the parameter 10!
AddCraft( typeof( RunicHammer ), "WOW", "Valorite Runic Hammer", SkillName.Blacksmith, 100.0, 120.0, typeof( Gold ), 1023822, 5000, 1019022, new object[] {CraftResource.Valorite, 10} );
// and if you have the fireable cannon script from script submissions that's been tweaked to compile in V1 RC0 you could even try this
AddCraft( typeof( fcannonDeed ), "WOW", "Fireable Cannon (North) Deed", SkillName.Blacksmith, 100.0, 120.0, typeof( IronIngot ), 1044036, 500, 1044037, new object[] {1} );
Installation: Replace same named files in the directory Scripts\Engines\Craft\Core\ Use at your leisure in any Def<craft> source files. NOTE: the newscript.php submission form was still not working at the time I originally posted this. I just sort of hacked my way arround the manage attachments (newattachment.php) section to get this to work. --editted May 14 2004--- I updated CraftItem.cs to allow crafting items of with a quantity in the constructor to use the SetUseAllRes. (there was one change on line 1241 to read "item.Amount = item.Amount * maxAmount;") For example, changing the crafting of shafts to make 12 shafts from each log/board, and still use all logs/boards in your inventory: Code:
index = AddCraft( typeof( Shaft ), 1044457, "Shafts (Logs x 12)", 0.0, 40.0, typeof( Log ), 1044041, 1, 1044351, new object[] {12} );
SetUseAllRes( index, true );
(old version had 343 dnloads) ----------------------------------------------------------------------------------------------------------------------------------- awdball · NON-beligerent Forum Member · · · · ;^) · · · · RUNUO-FAQ · · [CODE] Post CODE inside tags [/CODE] The team for moderation on RUNUO Forums · · · · HelpSomeone · · CAPitalizaTION Counts m_BeCareful! (old school c coder learning and luvin c#) · · · · · · · Great C# Tutorial · · Good forum searching tips
__________________
awdball |
|
|
|
|
|
#2 (permalink) | |
|
Join Date: Feb 2004
Posts: 7
|
Quote:
You are the grandmaster of C# dude! Are you on the development team? How do you find the time to do this stuff?! Thanks again! This will help me with a couple of modules I've been playing with at home. I'd give ya more good Karma if I could, but I've given you some already and haven't given out enough to others yet... oh well... Cheers dude! |
|
|
|
|
|
|
#3 (permalink) | |
|
Join Date: Feb 2004
Location: Canada eh
Posts: 413
|
Quote:
But any comments from you script developers out there on what you were able to do with this? Did I miss any cases, I know I found a bug late in the process, just before publishing this, where the crafting gump was trying to display the image of the item and failed horribly, did anyone see any other problems like that? Part of my intent with adding the ability to use parameters was to make it so we don't need to create shell objects for things like cannon which take a parameter on the constructor. Today we have MediumStoneTableEastDeed and MediumStoneTableSouthDeed. With this we could have just one MediumStoneTableDeed that took a direction as a parameter, and still have both craftable. Also to facilitate things like making 12 shafts from one log using something like Code:
AddCraft( typeof( Shaft ), 1044457, 1027124, 0.0, 40.0, typeof( Log ), 1044041, 1, 1044351, new object[] {12} );
-------------------------------------------------------------------------------- awdball · NON-beligerent Forum Member · · · · ;^) · · · · RUNUO-FAQ The team for moderation on RUNUO Forums · · · · HelpSomeone (old school c coder learning and luvin c#) · · · · · · · Great C# Tutorial
__________________
awdball |
|
|
|
|
|
|
#4 (permalink) | |
|
Newbie
|
Quote:
Code:
index = AddCraft( typeof( BeverageBottle ), "Drinks", "Bottle of Ale",
SkillName.Cooking, 0.0, 100.0, typeof( SackFlour ), 1044468, 1, 1044253, new object[]
{BeverageType.Ale, 1} );
AddRes( index, typeof( BaseBeverage ), 1046458, 1, 1044253 );
AddRes( index, typeof ( Bottle ), 1044529, 1, 500315 );
|
|
|
|
|
|
|
#5 (permalink) | |
|
Newbie
|
Quote:
|
|
|
|
|
|
|
#6 (permalink) | |
|
Join Date: Feb 2004
Location: Canada eh
Posts: 413
|
Quote:
----------------------------------------------------------------------------------------------------------------------------------- awdball · NON-beligerent Forum Member · · · · ;^) · · · · RUNUO-FAQ · · [CODE] Post CODE inside tags [/CODE] The team for moderation on RUNUO Forums · · · · HelpSomeone · · CAPitalizaTION Counts m_BeCareful! (old school c coder learning and luvin c#) · · · · · · · Great C# Tutorial
__________________
awdball |
|
|
|
|
|
|
#7 (permalink) |
|
Forum Expert
|
I have installed this, not all sure what it is, but i went ahead and added it in, and replaced, and it all compiles and all that, but when i went to make shafts the server crashed
Code:
using System;
using Server.Items;
namespace Server.Engines.Craft
{
public class DefBowFletching : CraftSystem
{
public override SkillName MainSkill
{
get { return SkillName.Fletching; }
}
public override int GumpTitleNumber
{
get { return 1044006; } // <CENTER>BOWCRAFT AND FLETCHING MENU</CENTER>
}
private static CraftSystem m_CraftSystem;
public static CraftSystem CraftSystem
{
get
{
if ( m_CraftSystem == null )
m_CraftSystem = new DefBowFletching();
return m_CraftSystem;
}
}
public override double GetChanceAtMin( CraftItem item )
{
return 0.5; // 50%
}
private DefBowFletching() : base( 1, 1, 1.25 )// base( 1, 2, 1.7 )
{
}
public override int CanCraft( Mobile from, BaseTool tool, Type itemType )
{
if ( tool.Deleted || tool.UsesRemaining < 0 )
return 1044038; // You have worn out your tool!
else if ( !BaseTool.CheckAccessible( tool, from ) )
return 1044263; // The tool must be on your person to use.
return 0;
}
public override void PlayCraftEffect( Mobile from )
{
// no animation
//if ( from.Body.Type == BodyType.Human && !from.Mounted )
// from.Animate( 33, 5, 1, true, false, 0 );
from.PlaySound( 0x55 );
}
public override int PlayEndingEffect( Mobile from, bool failed, bool lostMaterial, bool
toolBroken, int quality, bool makersMark, CraftItem item )
{
if ( toolBroken )
from.SendLocalizedMessage( 1044038 ); // You have worn out your tool
if ( failed )
{
if ( lostMaterial )
return 1044043; // You failed to create the item, and some of your
materials are lost.
else
return 1044157; // You failed to create the item, but no materials were
lost.
}
else
{
if ( quality == 0 )
return 502785; // You were barely able to make this item. It's quality
is below average.
else if ( makersMark && quality == 2 )
return 1044156; // You create an exceptional quality item and affix
your maker's mark.
else if ( quality == 2 )
return 1044155; // You create an exceptional quality item.
else
return 1044154; // You create the item.
}
}
public override CraftECA ECA{ get{ return CraftECA.FiftyPercentChanceMinusTenPercent; } }
public override void InitCraftList()
{
int index = -1;
// Materials
AddCraft( typeof( Kindling ), 1044457, 1023553, 0.0, 00.0, typeof( Log ), 1044041, 1,
1044351 );
AddCraft( typeof( Shaft ), 1044457, 1027124, 0.0, 40.0, typeof( Log ), 1044041, 1,
1044351, new object[] {12} );
SetUseAllRes( index, true );
// Ammunition
index = AddCraft( typeof( Arrow ), 1044565, 1023903, 0.0, 40.0, typeof( Shaft ),
1044560, 1, 1044561 );
AddRes( index, typeof( Feather ), 1044562, 1, 1044563 );
SetUseAllRes( index, true );
index = AddCraft( typeof( Bolt ), 1044565, 1027163, 0.0, 40.0, typeof( Shaft ),
1044560, 1, 1044561 );
AddRes( index, typeof( Feather ), 1044562, 1, 1044563 );
SetUseAllRes( index, true );
// Weapons
AddCraft( typeof( Bow ), 1044566, 1025042, 30.0, 70.0, typeof( Log ), 1044041, 7,
1044351 );
AddCraft( typeof( Crossbow ), 1044566, 1023919, 60.0, 100.0, typeof( Log ), 1044041, 7,
1044351 );
AddCraft( typeof( HeavyCrossbow ), 1044566, 1025117, 80.0, 120.0, typeof( Log ),
1044041, 10, 1044351 );
if ( Core.AOS )
{
AddCraft( typeof( CompositeBow ), 1044566, 1029922, 70.0, 110.0, typeof( Log ),
1044041, 10, 1044351 );
AddCraft( typeof( RepeatingCrossbow ), 1044566, 1029923, 90.0, 130.0, typeof(
Log ), 1044041, 10, 1044351 );
// AddCraft( typeof( OakBow ), 1044566, "Oak Bow", 35.0, 75.0, typeof( OakLog ),
"OakLog", 7, 1044351 );
// AddCraft( typeof( RedTreeBow ), 1044566, "RedTree Bow", 45.0, 80.0, typeof(
RedTreeLog ), "RedTreeLog", 7, 1044351 );
// AddCraft( typeof( DarkTreeBow ), 1044566, "DarkTree Bow", 50.0, 85.0, typeof(
DarkTreeLog ), "DarkTreeLog", 7, 1044351 );
// AddCraft( typeof( SwampBow ), 1044566, "Swamp Bow", 55.0, 90.0, typeof(
SwampLog ), "SwampLog", 7, 1044351 );
// AddCraft( typeof( KeranitBow ), 1044566, "Keranit Bow", 60.0, 95.0, typeof(
KeranitLog ), "KeranitLog", 7, 1044351 );
// AddCraft( typeof( AvalonBow ), 1044566, "Avalon Bow", 70.0, 100.0, typeof(
AvalonLog ), "AvalonLog", 7, 1044351 );
// AddCraft( typeof( ElvenBow ), 1044566, "Elven Bow", 80.0, 105.0, typeof(
ElvenLog ), "ElvenLog", 7, 1044351 );
// AddCraft( typeof( AsterxylonBow ), 1044566, "Asterxylon Bow", 90.0, 110.0,
typeof( AsterxylonLog ), "AsterxylonLog", 7, 1044351 );
}
// Begining of modification by FNP to add Triel_Toria's lumber to the bowcrafting menu.
// Set the overidable material
SetSubRes( typeof( Log ), "LOGS" );
// Add every material you want the player to be able to chose from
// This will overide the overidable material
AddSubRes( typeof( Log ), "LOGS", 00.0, 0 );
AddSubRes( typeof( OakLog ), "OAK LOGS", 55.0, "You have no idea how to work
this type of lumber." );
AddSubRes( typeof( RedTreeLog ), "REDTREE LOGS", 60.0, "You have no idea how to
work this type of lumber." );
AddSubRes( typeof( DarkTreeLog ), "DARKTREE LOGS", 65.0, "You have no idea how to
work this type of lumber." );
AddSubRes( typeof( SwampLog ), "SWAMP LOGS", 70.0, "You have no idea how to
work this type of lumber." );
AddSubRes( typeof( KeranitLog ), "KERANIT LOGS", 75.0, "You have no idea how to
work this type of lumber." );
AddSubRes( typeof( AvalonLog ), "AVALON LOGS", 80.0, "You have no idea how to
work this type of lumber." );
AddSubRes( typeof( ElvenLog ), "ELVEN LOGS", 85.0, "You have no idea how to
work this type of lumber." );
AddSubRes( typeof( AsterxylonLog ), "ASTERXYLON LOGS", 90.0, "You have no idea how
to work this type of lumber." );
// End of modification by FNP to add Triel_Toria's lumber to the bowcrafting menu.
MarkOption = true;
Repair = true;
}
}
}
__________________
Med-Surg Nurse, Full time Pittsburg State Univ Sophmore, and FT Mother to 5 kids |
|
|
|
|
|
#8 (permalink) | |
|
Join Date: Feb 2004
Location: Canada eh
Posts: 413
|
Quote:
Code:
index = AddCraft( typeof( Shaft ), 1044457, 1027124, 0.0, 40.0, typeof( Log ), 1044041, 1, 1044351, new object[] {12} );
SetUseAllRes( index, true );
By the way I hadn't tested the make 12 shafts from one log with the useall resources option yet. That's not working correctly so I don't suggest you use it I'll post a fix shortly. You can use just the addcraft line by itself, no SetUseAllRes for now. ----------------------------------------------------------------------------------------------------------------------------------- awdball · NON-beligerent Forum Member · · · · ;^) · · · · RUNUO-FAQ · · [CODE] Post CODE inside tags [/CODE] The team for moderation on RUNUO Forums · · · · HelpSomeone · · CAPitalizaTION Counts m_BeCareful! (old school c coder learning and luvin c#) · · · · · · · Great C# Tutorial
__________________
awdball |
|
|
|
|
|
|
#9 (permalink) |
|
Join Date: Feb 2004
Location: Canada eh
Posts: 413
|
I believe the fix to get SetUseAllRes to work when the craftable has a quantity is to change in CraftItem.cs (line 1241) the CompleteCraft method this
Code:
if ( maxAmount > 0 ) item.Amount = maxAmount; Code:
if ( maxAmount > 0 ) item.Amount = item.Amount * maxAmount; --editted-- Finished testing, worked like a charm, updated the download. May I suggest flowerbudd that you use this: Code:
index = AddCraft( typeof( Shaft ), 1044457, "Shafts (Logs x 12)", 0.0, 40.0,
typeof( Log ), 1044041, 1, 1044351, new object[] {12} );
SetUseAllRes( index, true );
----------------------------------------------------------------------------------------------------------------------------------- awdball · NON-beligerent Forum Member · · · · ;^) · · · · RUNUO-FAQ · · [CODE] Post CODE inside tags [/CODE] The team for moderation on RUNUO Forums · · · · HelpSomeone · · CAPitalizaTION Counts m_BeCareful! (old school c coder learning and luvin c#) · · · · · · · Great C# Tutorial · · Good forum searching tips
__________________
awdball |
|
|
|
|
|
#10 (permalink) |
|
Forum Expert
|
Ohh i never saw the updated thread with your fix, the first post you had about it was the last i had seen and that one wasnt working for me, i will try this one
__________________
Med-Surg Nurse, Full time Pittsburg State Univ Sophmore, and FT Mother to 5 kids |
|
|
|
|
|
#12 (permalink) | |
|
Join Date: Feb 2004
Location: Canada eh
Posts: 413
|
Quote:
--edditted-- got your PM flowerbudd, I sent you a merged version of my changes to CraftItem with your changes. Were the other script files unchanged? Did you use all of my other modded scripts in addition to CraftItem? (CraftGroup.cs, CraftGumpItem.cs, CraftRes.cs, CraftSystem.cs) ----------------------------------------------------------------------------------------------------------------------------------- awdball · NON-beligerent Forum Member · · · · ;^) · · · · RUNUO-FAQ · · [CODE] Post CODE inside tags [/CODE] The team for moderation on RUNUO Forums · · · · HelpSomeone · · CAPitalizaTION Counts m_BeCareful! (old school c coder learning and luvin c#) · · · · · · · Great C# Tutorial · · Good forum searching tips
__________________
awdball |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|