|
||
|
|||||||
| Modification Suggestions This is where you can suggest a modifcation to RunUO! |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Forum Master
Join Date: Feb 2005
Location: ShatteredSosaria.com
Posts: 9,260
|
Okay, this is really starting to tick me off. Any time I have a great idea that would require a modification to all classes (either item or mobile), I have to ditch it because it would require a core modification. I think it would be nice to have "empty" classes; so:
-BaseItem is in the core -Item (containing no functions, just a blank class) which is a sub-class of BaseItem, is in the regular scripts -Everything branches off of Item That way, if I want to add a property to all items, it doesn't require a core modification. The same thing goes for mobiles. This would make things easier to add stuff to everything in a class. Comments please. |
|
|
|
|
|
#3 (permalink) | |
|
Forum Expert
Join Date: Mar 2004
Location: NorthCentral IL, USA
Age: 35
Posts: 3,848
|
yah i had done that at one point but eventually went away from it (mostly cause i was too lazy to go back through and change all Mobile references to BaseMobile and all Item references to BaseItem. It was usefull the first time i added the personal bless deed to my shard. also when i was adding my global level system that I wanted to affect players and creatures alike. but anywho, it's doable but i dont ever see it happening officially.
__________________
Quote:
Just a Simple Staff Tool You can leave me messages. Ernest Gary Gygax - Quote "I would like the world to remember me as the guy who really enjoyed playing games and sharing his knowledge and his fun pastimes with everybody else." |
|
|
|
|
|
|
#5 (permalink) | ||
|
Forum Expert
Join Date: Mar 2004
Location: NorthCentral IL, USA
Age: 35
Posts: 3,848
|
Quote:
__________________
Quote:
Just a Simple Staff Tool You can leave me messages. Ernest Gary Gygax - Quote "I would like the world to remember me as the guy who really enjoyed playing games and sharing his knowledge and his fun pastimes with everybody else." |
||
|
|
|
|
|
#6 (permalink) | |
|
Forum Novice
Join Date: Jul 2004
Location: Switzerland
Age: 25
Posts: 234
|
Quote:
Code:
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
if(OldVersion) // only to call if the save has items with 'my' data
{
int version = reader.ReadInt();
}
}
That works for all inherited classes. Now the core code; core-Item is a directly constructable class, thus, the mentioned subclass would be surpassable. This could be avoided by making the item class non-constructable and abstract. Of course with a rename to BaseItem and all references to it withing the core, otherwise most bundled scripts with a new Item() call would stop working. If the core containes a new-call to this abstract class, it would stop to work as well. That would be all, i think. Correct me if not Now what can 'OldVersion' be... a simple bool for the scripter who needs the convert? a startup-parameter? a configure variable? an automatic value fetched out of the save-format? Comments... This would make many things easier, especially own functionality. But i dont see a real need to do that. The above mentioned way inflicts a lot more than only the things listed. Once the Item class gets abstract, the next step would logically be to make as much functions as possible virtual or abstact too. That would raise expenses in safety, maintainability, and speed. Oh, forgot, i'm an optimist ![]() |
|
|
|
|
|
|
#8 (permalink) |
|
ConnectUO Creator
Join Date: Jan 2004
Age: 28
Posts: 4,892
|
Ah interesting topic, I would like to see a good answer to this
__________________
Jeff Boulanger ConnectUO - Core Developer Want to help make ConnectUO better? Click here to submit your ideas/requests Use your talent to compete against other community members in RunUO hosted coding competitions If you know XNA (even if its just a little) or are a good artist(2d or 3d) and are interested in making games for a hobby send me a pm or drop by #xna in irc.runuo.com. I'm looking to put together a small game development team. Please do not pm me for support. If you are having issues please post in the appropriate forum. Thanks for your continued support of both ConnectUO and RunUO |
|
|
|
|
|
#9 (permalink) |
|
Forum Master
Join Date: Feb 2005
Location: ShatteredSosaria.com
Posts: 9,260
|
Code:
using System;
using Server;
namespace Server.Items
{
public class Item : BaseItem
{
public Item( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}
Again, this isn't really an issue of need, but rather an issue of want; it would be a lot easier to make global modifications to the item and mobile classes if this "method" was instituted, and I'm sure more people would be encouraged to make a wider variety of scripts. |
|
|
|
|
|
#11 (permalink) |
|
Join Date: Oct 2002
Age: 23
Posts: 4,689
|
And Joeku, I just said that you can do that (with no problems), if you do
Code:
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
}
|
|
|
|
|
|
#12 (permalink) |
|
RunUO Developer/Demise Person
Join Date: Mar 2003
Location: California
Age: 20
Posts: 1,700
|
__________________
Andre Sayre, Core Developer The RunUO Software Team The day we are born is the day Death inches ever closer... E-mail: ASayre ( AT ) RunUO ( Dot ) c o m I'm as graceful as a gazelle galloping over glistening green grass with it's head on fire. |
|
|
|
|
|
#14 (permalink) | |
|
Forum Newbie
Join Date: Jul 2004
Posts: 59
|
Quote:
These "Extension Methods" provide a very very limited AOP type feature to deal with these concerns. There are a couple of Aspect Weavers that I am aware of that allow one to deal with this issue elegantly using the AOP constructs/extensions to the C# language. My previous question on whether custom attributes can provide a limited solution to this problem still stands, and would be interested to know how it works. Last edited by xir; 01-27-2006 at 08:38 PM. |
|
|
|
|
|
|
#15 (permalink) | |
|
Forum Expert
Join Date: Sep 2002
Location: Houston, Texas
Age: 22
Posts: 3,933
|
Quote:
|
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|