RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Dupe command

philadan

Wanderer
Dupe command

I'm not much of a C# programmer, and I don't run my own runuo server, however I've noticed a problem GM's are having on a server I play on... it seams the Dupe command there doesnt copy over each attribute of the copied item, only the item id & resist values. Its possible their server has a messed up dupe command, but just in case it hasn't been addressed, I'm throwing it out there.

an admin said they were running runuo 1.0.0 there.
 

sirens song

Wanderer
Iv never actually used the dupe command, but I just looked at it and it is a problem in Dupe.cs code. Its probably not a problem with their server. The command just needs to be expanded on.
 

paladineD

Wanderer
I have noticed when using the dupe command it goes by the base of the constructable. I.E say you made some changes to and item like a weapon, when you go to dupe the item usually the changes are dropped cause it looks at the items constructable part of the script and it sees what is actually on it that way. that doesnt mean that some items it will retain some of all of their mods.

But yes its not a real problem with either, it works the way its supposed to. And yes it would be cool to expand on it, but im not that good of a scripter to even try that yet.
 

davidmohara

Sorceror
I believe that this was on purpose. I recall that they changed this in one of the previous betas because we used to be able to dupe jewelry and it would be an EXACT copy. Now, it's only a copy of the base item. Perhaps we should have an additional command to do exact copying.
 

A_Li_N

Knight
If someone can help me figure out the code to access the whole Properties list, I could make this command.

Basically I'd make a 'dupe' of the base item, then assign all of the extra parts that have been changed
 

Atomic

Wanderer
What about about duping the AosAttributes with a code similar to the current dupe code and then setting it to the new item?
 

A_Li_N

Knight
If I did this script, it would include the total range of things in UO. So if you had a Creature with changed stats, you could use the command to make an exact copy of it. Same with armor/weapons/items/etc.
 

A_Li_N

Knight
L0rdDarkScythe said:
why not instead of having to dupe the item just script the item and add it where ever ya wanted to like I do? :)
Because a script requires a restart of the server, as well as scripting the item. If you have a custom item in game, and want to make a copy of it to give to another person, it's a hella lot easier to simply do [CDupe and target the item than it is to script the item, get it to the host, restart the server.

And No, I havn't started on this yet. :D Other projects are taking precidence.
 

Kamron

Knight
There isn't a real problem with duping items and all of their properties, however it becomes slow if you are copying EVERY SINGLE property of every inhereted class.. and then lets say your making 20 copies of that item.

The real problem with dupe, is the fact that its infeasible to dupe a container and all of its contents, as you can easily slow down a server making 100 copies of a bag with over 200 items in them that have alot of properties.

The easiest way to make it do what you want, is to have it copy all properties which have CommandProperty and/or PropertyObject attributes. You can do a loop through all properties, then you can isolate the ones which are settable in-game, and then set them accordingly.
 

A_Li_N

Knight
XxSP1DERxX said:
The easiest way to make it do what you want, is to have it copy all properties which have CommandProperty and/or PropertyObject attributes. You can do a loop through all properties, then you can isolate the ones which are settable in-game, and then set them accordingly.
*Notes this down* I'll remember that when I try to work on this :) Thanks
 

Spudz777

Sorceror
I'd also like to work on this, but I have little time to devote... I'll post back if I find anything interesting.
 

lan_party

Wanderer
I want to dupe and have it stack. Yeah. That'd be so freaking cool. Instead of like a bagillion seperate thingies. Yeah.
 

Killamus

Knight
Why don't you try like
Code:
public override void OnDupe(Item from)
if ( from != BaseJewelry || BaseSheild || BaseArmor )
{
get( from.WeaponAttribute.*insert attribute*;
Repeat
}
else if ( from != BaseWeapon || BaseSheild || BaseArmor )
{
*see above*
}
Else (and you get the idea)
I accually think this might work, I just happened to remember something like this in the spellcrafting idea. Of corse, there may or may not be an easyer way to do this.
 

Kamron

Knight
Thats bad coding practice (to do type checks for no reason).

There are multiple problems with this, where it wouldn't be a problem in C++ for example. Although in C++ you can do this, but I don't know if its possible, or easy in C#. It seems that the best way to do it, is to allocate memory for all of the required items (containers, etc), and their properties. Do a single real dupe with adjacent memory locations. Then clone the memory in a raw fashion and dump it X times. Then after that, assign a valid serial number for each item and container.
 

Kamron

Knight
You don't need to, because in C# you can make a PropertyInfo[] of any instance of an object. Right there you have all of the properties. Then you can do what you want with them.
 
Top