CEO
Sorceror
CEO's Yet Another Arya Addon Generator (YAAAG) RC1/RC2
After taking a look at Hammer's nice waterfall addons I decided to checkout Arya's initial work (brilliant!) and tinker around with it. I pretty much ended up rewriting nearly all of it and also reworking the Addon code that's generated to be more efficient by using static tables. The Gump is also reworked with the ability to export statics, items(new), and tiles each having their own unique ID range(included or excluded). Basically you can now check out a player's artwork in their house and easily create an Addon from it. Also for those that like to create an Addon and check that it's right you also now can generate a test Addon on-the-fly and place it without having to recompile to see it, which should be a great time saving tool! This test Addon has all the components identified by where they are in the generated commented code so you can easily tinker with it. For example here's what Hammer's SmallWaterfallEastAddon looks like with new code(Just the AddOn part):
And here's sample of how the test Addon's components are created and identified:
The 1st number is the corresponding number of where it is in the commented code, the 2nd is its static ID and then its x/y/z displacement. See how quick you can find that component in the comment code.
New gump:
Each exported type by default falls within the standard static ID ranges with the checked values. To reverse ranges selection method simply uncheck it and only ID's that fall outside that range are selected for the Addon. Same goes for the Z axis, by default all Z values are included. By using a combo of includes/excludes and narrowed ranges you can ignore certain IDs that you don't want to include in your new Addon. The new Test&Gen button writes the Addon and pops up a target for you to place what you've just defined and IDing each component(see above). Note: When saving an Item in the Addon, it is turned into a Static. As a result no properties are carried over, sorry that's the way Addons work.
About the table formats
The m_AddOnSimpleComponents table is generated with 4 values per component. IE:
They are the Static ID, x/y/z displacements.
The m_AddOnComplexComponents table is generated with 6 values per component. IE:
They are the Static ID, x/y/z displacements, Hue, and LightSource (-1 if none).
In the case of a component that has a modified Name field, a single line is generated for each component, which will look something like this:
Same order as the complex table, with the Name field added on the end.
Works with both RC1 and RC2, simply remove or comment out the
line near the top of the code to switch to Arrays vs. List<> (RC2) code.
After taking a look at Hammer's nice waterfall addons I decided to checkout Arya's initial work (brilliant!) and tinker around with it. I pretty much ended up rewriting nearly all of it and also reworking the Addon code that's generated to be more efficient by using static tables. The Gump is also reworked with the ability to export statics, items(new), and tiles each having their own unique ID range(included or excluded). Basically you can now check out a player's artwork in their house and easily create an Addon from it. Also for those that like to create an Addon and check that it's right you also now can generate a test Addon on-the-fly and place it without having to recompile to see it, which should be a great time saving tool! This test Addon has all the components identified by where they are in the generated commented code so you can easily tinker with it. For example here's what Hammer's SmallWaterfallEastAddon looks like with new code(Just the AddOn part):
Code:
public class SmallWaterfallEastAddon : BaseAddon
{
private static int[,] m_AddOnSimpleComponents = new int[,] {
{6039, 0, -1, 1}, {6039, 1, -1, 1}, {4944, -1, -1, 1}// 1 2 3
, {4932, -2, -1, 1}, {4958, -2, -1, 5}, {4959, -1, -1, 1}// 4 5 6
, {4960, 0, -1, 1}, {4963, 0, -1, 3}, {4967, 1, -1, 3}// 7 8 9
, {4970, 1, -1, 2}, {4945, -1, -2, 1}, {4973, 2, -1, 5}// 10 11 12
, {4963, 2, -1, 1}, {6039, 2, -1, 1}, {4967, 3, -1, 3}// 13 14 15
, {4970, 3, -1, 1}, {13422, 1, 0, 2}, {13422, 1, 1, 2}// 16 17 18
, {13555, -1, 1, 1}, {13555, -1, 0, 1}, {6002, -3, 1, 2}// 19 20 21
, {6006, -2, 0, 3}, {4956, -3, 0, 5}, {4963, -1, 0, 14}// 22 23 24
, {13451, 1, 0, 3}, {6009, 3, 0, 3}, {4963, 3, 1, 3}// 25 26 27
, {13422, 2, 1, 2}, {13422, 2, 0, 2}, {3248, 3, 0, 8}// 28 29 30
, {13573, 0, 1, 1}, {13573, 0, 0, 1}, {4943, -3, 3, 1}// 31 32 35
, {4944, -2, 3, 1}, {13422, 1, 2, 2}, {13555, -1, 2, 1}// 36 37 38
, {4959, -1, 3, 9}, {4960, 0, 3, 9}, {6002, -2, 2, 5}// 39 40 41
, {4963, 0, 3, 1}, {6001, 1, 3, 1}, {4962, -1, 3, 1}// 42 43 44
, {4963, -2, 2, 1}, {4970, -1, 3, 19}, {6001, -1, 2, 20}// 45 46 47
, {4967, 0, 3, 1}, {3219, -1, 3, 14}, {4967, 3, 2, 3}// 48 49 50
, {4970, 3, 3, 7}, {4967, 3, 3, 7}, {13422, 2, 2, 2}// 51 52 53
, {4962, 2, 3, 2}, {4963, 3, 3, 2}, {13573, 0, 2, 1}// 54 55 56
};
private static int[,] m_AddOnComplexComponents = new int[,] {
{6010, -3, 0, 0, 1885, -1 }, {4967, -1, 1, 19, 1891, -1 }// 33 34
};
public override BaseAddonDeed Deed
{
get
{
return new SmallWaterfallEastAddonDeed();
}
}
[ Constructable ]
public SmallWaterfallEastAddon()
{
for (int i = 0; i < m_AddOnSimpleComponents.Length / 4; i++)
AddComponent( new AddonComponent( m_AddOnSimpleComponents[i,0] ), m_AddOnSimpleComponents[i,1], m_AddOnSimpleComponents[i,2], m_AddOnSimpleComponents[i,3] );
for (int i = 0; i < m_AddOnComplexComponents.Length / 6; i++)
AddComplexComponent((BaseAddon)this, m_AddOnComplexComponents[i,0], m_AddOnComplexComponents[i,1], m_AddOnComplexComponents[i,2], m_AddOnComplexComponents[i,3], m_AddOnComplexComponents[i,4], m_AddOnComplexComponents[i,5] );
}
public SmallWaterfallEastAddon( Serial serial ) : base( serial )
{
}
private static void AddComplexComponent(BaseAddon addon, int item, int xoffset, int yoffset, int zoffset, int hue, int lightsource)
{
AddComplexComponent(addon, item, xoffset, yoffset, zoffset, hue, lightsource, null);
}
private static void AddComplexComponent(BaseAddon addon, int item, int xoffset, int yoffset, int zoffset, int hue, int lightsource, string name)
{
AddonComponent ac;
ac = new AddonComponent(item);
if (name != null)
ac.Name = name;
if (hue != 0)
ac.Hue = hue;
if (lightsource != -1)
ac.Light = (LightType) lightsource;
addon.AddComponent(ac, xoffset, yoffset, zoffset);
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( 0 ); // Version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
The 1st number is the corresponding number of where it is in the commented code, the 2nd is its static ID and then its x/y/z displacement. See how quick you can find that component in the comment code.
New gump:
Each exported type by default falls within the standard static ID ranges with the checked values. To reverse ranges selection method simply uncheck it and only ID's that fall outside that range are selected for the Addon. Same goes for the Z axis, by default all Z values are included. By using a combo of includes/excludes and narrowed ranges you can ignore certain IDs that you don't want to include in your new Addon. The new Test&Gen button writes the Addon and pops up a target for you to place what you've just defined and IDing each component(see above). Note: When saving an Item in the Addon, it is turned into a Static. As a result no properties are carried over, sorry that's the way Addons work.
About the table formats
The m_AddOnSimpleComponents table is generated with 4 values per component. IE:
Code:
{14284, 1, 2, 3}, {13573, 0, 0, 1}, {13573, 0, 1, 1}// 2 6 7
The m_AddOnComplexComponents table is generated with 6 values per component. IE:
Code:
{6010, -3, 0, 0, 1885, -1 }, {4967, -1, 1, 19, 1891, -1 }// 5 20
In the case of a component that has a modified Name field, a single line is generated for each component, which will look something like this:
Code:
AddComplexComponent( (BaseAddon) this, 3630, 4, 0, 0, 37, 2, "Red Ball" );// 1
Works with both RC1 and RC2, simply remove or comment out the
Code:
#define RC2