|
From: s <s.s...@gm...> - 2010-05-19 09:08:10
|
Hey dudes I saw that you guys had started on implementing classes through an enum, and then persisting that on serialization, which I think is the wrong way to go. I'd already done quite a few changes before joining the project, and one of them was working in classes. So I'll briefly outline what i've done now. The system I've set up works like this: *ZuluClass* Base abstract class, This is the class that is inherited by all classes. Method IsClassed to check if a PlayerMobile is from the calling inherited class, if so returns the level as a ushort higher than 1. ZuluClass Array, which includes all the player classes. Members for Prohibited Items, Prohibited Magical Mods, Stat Affinities and Stat Difficulties etc. to be set by the inherited class. *Classes* (Warrior, Mage, Thief etc.) These all follow the singleton pattern<http://www.yoda.arachsys.com/csharp/singleton.html>, each class has only one Instance available. When instantiated they set their static class properties. *Players* I added the ZuluClass and ZuluClassLevel properties. Basically these two are what get accessed to find out a players class and level. A players class is only updated when their skills update or on first access. The only problem so far is the IsClassed method on the ZuluClass... class :P I've based it off the actual function from the ZH scripts, and I think the maths is terribly inefficient, but unfortunately I'm terrible at maths, so hopefully one of you guys could look at it if you want to use this class system? |